-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
list index out of range #27
Comments
Hi, you can debug these two lines of code in self.images = [image_root + f for f in os.listdir(image_root) if f.endswith('.jpg') or f.endswith('.png')]
self.gts = [gt_root + f for f in os.listdir(gt_root) if f.endswith('.png')]
print(len(self.images))
print(len(self.gts)) |
thanks for your answer,I've solve this problem
xiongxyowo ***@***.***> 于2024年11月8日周五 09:29写道:
… Hi, you can debug these two lines of code in dataset.py to check if the
data is loaded correctly:
self.images = [image_root + f for f in os.listdir(image_root) if f.endswith('.jpg') or f.endswith('.png')]self.gts = [gt_root + f for f in os.listdir(gt_root) if f.endswith('.png')]print(len(self.images))print(len(self.gts))
—
Reply to this email directly, view it on GitHub
<#27 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BA6G7MVXFEP4Q6BDGHLHHVTZ7QHX5AVCNFSM6AAAAABRLWUPP2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINRTGU3TCOJXGU>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
mask改成png格式试试
gzy1234 ***@***.***> 于2024年12月12日周四 11:07写道:
… python train.py --hiera_path "/root/sam2-unet-main/sam2_hiera_large.pt"
--train_image_path "/root/autodl-tmp/DUTS-TR/DUTS-TR-Image/"
--train_mask_path "/root//autodl-tmp/DUTS-TR/DUTS-TR-Mask/" --save_path
"/root/sam2-unet-main" --epoch 20 --lr 0.001 --batch_size 12 Traceback
(most recent call last): File "/root/sam2-unet-main/train.py", line 133, in
main(args) File "/root/sam2-unet-main/train.py", line 105, in main for i,
batch in enumerate(dataloader): File
"/root/miniconda3/lib/python3.12/site-packages/torch/utils/data/dataloader.py",
line 630, in next data = self._next_data() ^^^^^^^^^^^^^^^^^ File
"/root/miniconda3/lib/python3.12/site-packages/torch/utils/data/dataloader.py",
line 1344, in _next_data return self._process_data(data)
^^^^^^^^^^^^^^^^^^^^^^^^ File
"/root/miniconda3/lib/python3.12/site-packages/torch/utils/data/dataloader.py",
line 1370, in _process_data data.reraise() File
"/root/miniconda3/lib/python3.12/site-packages/torch/_utils.py", line 706,
in reraise raise exception IndexError: Caught IndexError in DataLoader
worker process 0. Original Traceback (most recent call last): File
"/root/miniconda3/lib/python3.12/site-packages/torch/utils/data/_utils/worker.py",
line 309, in _worker_loop data = fetcher.fetch(index) # type:
ignore[possibly-undefined] ^^^^^^^^^^^^^^^^^^^^ File
"/root/miniconda3/lib/python3.12/site-packages/torch/utils/data/_utils/fetch.py",
line 52, in fetch data = [self.dataset[idx] for idx in
possibly_batched_index]
File "/root/sam2-unet-main/dataset.py", line 188, in getitem
label = self.binary_loader(self.gts[idx])
~~~~~~~~^^^^^
IndexError: list index out of range
为什么我一直报出这样的错误的,我已经检查过image与mask是一一对应的
想请问下您是怎么解决的?
—
Reply to this email directly, view it on GitHub
<#27 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BA6G7MUEQXHDN7RN63MJTQT2FD4XXAVCNFSM6AAAAABRLWUPP2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMZXG4YDMMZYGY>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
python train.py
--hiera_path "/root/sam2-unet-main/sam2_hiera_large.pt"
--train_image_path "/root/autodl-tmp/DUTS-TR/DUTS-TR-Image/"
--train_mask_path "/root//autodl-tmp/DUTS-TR/DUTS-TR-Mask/"
--save_path "/root/sam2-unet-main"
--epoch 20
--lr 0.001
--batch_size 12
Traceback (most recent call last):
File "/root/sam2-unet-main/train.py", line 133, in
main(args)
File "/root/sam2-unet-main/train.py", line 105, in main
for i, batch in enumerate(dataloader):
File "/root/miniconda3/lib/python3.12/site-packages/torch/utils/data/dataloader.py", line 630, in next
data = self._next_data()
^^^^^^^^^^^^^^^^^
File "/root/miniconda3/lib/python3.12/site-packages/torch/utils/data/dataloader.py", line 1344, in _next_data
return self._process_data(data)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/lib/python3.12/site-packages/torch/utils/data/dataloader.py", line 1370, in _process_data
data.reraise()
File "/root/miniconda3/lib/python3.12/site-packages/torch/_utils.py", line 706, in reraise
raise exception
IndexError: Caught IndexError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/root/miniconda3/lib/python3.12/site-packages/torch/utils/data/_utils/worker.py", line 309, in _worker_loop
data = fetcher.fetch(index) # type: ignore[possibly-undefined]
^^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/lib/python3.12/site-packages/torch/utils/data/_utils/fetch.py", line 52, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
The text was updated successfully, but these errors were encountered: