Skip to content
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

Error when training coco @batch 1473, epoch 0 #36

Closed
CaptainEven opened this issue Jun 13, 2018 · 4 comments
Closed

Error when training coco @batch 1473, epoch 0 #36

CaptainEven opened this issue Jun 13, 2018 · 4 comments

Comments

@CaptainEven
Copy link

Epoch 0/1000, Batch 1473/7329 | Losses: x 0.126482, y 0.129091, w 0.692879, h 0.779148, conf 0.268520, cls 1.789521, total 3.785640
Traceback (most recent call last):
File "/mnt/diskb/even/yolov3_pytorch/train.py", line 97, in
for batch_i, (_, imgs, targets) in enumerate(dataloader):
File "/usr/local/lib/python3.5/dist-packages/torch/utils/data/dataloader.py", line 264, in next
batch = self.collate_fn([self.dataset[i] for i in indices])
File "/usr/local/lib/python3.5/dist-packages/torch/utils/data/dataloader.py", line 264, in
batch = self.collate_fn([self.dataset[i] for i in indices])
File "/mnt/diskb/even/yolov3_pytorch/utils/datasets.py", line 73, in getitem
h, w, _ = img.shape
ValueError: not enough values to unpack (expected 3, got 0)

@alexandru-dinu
Copy link

Because img is a numpy array that wraps the returned PIL Image, I am guessing that None is returned, and so np.array(None).shape is (), hence the got 0.

@CaptainEven
Copy link
Author

@alexandru-dinu the training is fine from start, and the error happened @Batch 1473....i don't understand

@chijan-nh
Copy link

chijan-nh commented Oct 15, 2018

I got similar issue in detect.py.
The attached data/samples can be run, however, if grayscale images are given as data/samples, then "not enough values to unpack" error is reproduced.
The code h,w,_=img.shape caused this error because the grayscale image does not have channels, i.e. , len(img.shape)==2.

I think the @Batch 1473 's images are broken (including None). The #36 issue may be caused by the dataset. Until @Batch 1472, the dataset is normal, I think.
My dirty hack is (1) get len(img.shape) and (2) use if divided; if len(img.shape)!=3, then this batch is ignored.

@eriklindernoren
Copy link
Owner

This was caused by a grayscale image in the dataset. It's fixed in master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants