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
TypeError: 'NoneType' object is not subscriptable #256
Comments
Hi,I also met the same problem,Have you solved it? |
I ran into this issue and it ended up being caused by having training images that did not have corresponding labels. I removed the images that did not have annotations and that fixed the problem. Hope that fixes the issue for you as well. |
oh ,thanks .Maybe I have a bad data set |
你解决这个问题了吗? 我在datasets.py第100行把 |
It could be this: your image suffix being uppercase JPG or uppercase PNG causes problems with dataset reading your label_files.You can do it this way: |
other error appear: |
灰常感谢! |
It is True, Thank you! |
I checked my images and every single one of them has annotations. Removing them is no use, I tried that. I checked that all the suffixes are lowercase too, and I'm unable to run this. Any ideas? |
could you solve it? |
楼主解决了这个问题了吗,我现在也遇到了这个问题,不知道怎么弄了 |
This part of the code has been updated or removed. I, therefore, close this issue now. Feel free to reopen for further discussion. |
Thank you very much. I tried with half of my dataset in order to get out the incomplete or erroneous labels and I finally could identify the labels with problems. Greets!! |
Have there anyone else who met the same problem as I met?
It can train in some batch,however meet the error suddenly.
I am sure the path is correct.but I don't know how to solve it
---- [Epoch 0/100, Batch 7/55] ---- +------------+--------------+--------------+--------------+ | Metrics | YOLO Layer 0 | YOLO Layer 1 | YOLO Layer 2 | +------------+--------------+--------------+--------------+ | grid_size | 16 | 32 | 64 | | loss | 53.503120 | 49.941383 | 60.964851 | | x | 0.109302 | 0.079437 | 0.094549 | | y | 0.089693 | 0.093862 | 0.099689 | | w | 1.409947 | 0.991294 | 2.199120 | | h | 0.381467 | 0.345485 | 4.021410 | | conf | 50.943905 | 47.888214 | 53.957447 | | cls | 0.568806 | 0.543090 | 0.592637 | | cls_acc | 2.04% | 0.00% | 12.24% | | recall50 | 0.000000 | 0.000000 | 0.000000 | | recall75 | 0.000000 | 0.000000 | 0.000000 | | precision | 0.000000 | 0.000000 | 0.000000 | | conf_obj | 0.380452 | 0.323845 | 0.408052 | | conf_noobj | 0.388892 | 0.365904 | 0.407760 | +------------+--------------+--------------+--------------+
File "train.py", line 100, in <module> for batch_i, (_, imgs, targets) in enumerate(dataloader): File "/root/anaconda2/envs/keyan/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 568, in __next__ return self._process_next_batch(batch) File "/root/anaconda2/envs/keyan/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 608, in _process_next_batch raise batch.exc_type(batch.exc_msg) TypeError: Traceback (most recent call last): File "/root/anaconda2/envs/keyan/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 99, in _worker_loop samples = collate_fn([dataset[i] for i in batch_indices]) File "/root/anaconda2/envs/keyan/lib/python3.6/site-packages/torch/utils/data/_utils/worker.py", line 99, in <listcomp> samples = collate_fn([dataset[i] for i in batch_indices]) File "/home/yanghanxun/PyTorch-YOLOv3_05/utils/datasets.py", line 130, in __getitem__ img, targets = horisontal_flip(img, targets) File "/home/yanghanxun/PyTorch-YOLOv3_05/utils/augmentations.py", line 8, in horisontal_flip targets[:, 2] = 1 - targets[:, 2] TypeError: 'NoneType' object is not subscriptable
The text was updated successfully, but these errors were encountered: