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

IndexError: list index out of range #12

Open
why228430 opened this issue Oct 17, 2020 · 7 comments
Open

IndexError: list index out of range #12

why228430 opened this issue Oct 17, 2020 · 7 comments

Comments

@why228430
Copy link

when I run "sh rtools/train.sh",I meet the error. How I can do to solve the problem?
2020-10-17 10:25:11,392 - mmdet - INFO - Saving checkpoint at 1 epochs
completed: 0, elapsed: 0sTraceback (most recent call last):
File "tools/train.py", line 161, in
main()
File "tools/train.py", line 157, in main
meta=meta)
File "/home/dl/anaconda3/lib/python3.7/site-packages/mmdet-2.1.0+8f3868f-py3.7-linux-x86_64.egg/mmdet/apis/train.py", line 179, in train_detector
runner.run(data_loaders, cfg.workflow, cfg.total_epochs)
File "/home/dl/anaconda3/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 122, in run
epoch_runner(data_loaders[i], **kwargs)
File "/home/dl/anaconda3/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 46, in train
self.call_hook('after_train_epoch')
File "/home/dl/anaconda3/lib/python3.7/site-packages/mmcv/runner/base_runner.py", line 282, in call_hook
getattr(hook, fn_name)(self)
File "/home/dl/anaconda3/lib/python3.7/site-packages/mmdet-2.1.0+8f3868f-py3.7-linux-x86_64.egg/mmdet/core/evaluation/eval_hooks.py", line 28, in after_train_epoch
self.evaluate(runner, results)
File "/home/dl/anaconda3/lib/python3.7/site-packages/mmdet-2.1.0+8f3868f-py3.7-linux-x86_64.egg/mmdet/core/evaluation/eval_hooks.py", line 32, in evaluate
results, logger=runner.logger, **self.eval_kwargs)
File "/home/dl/anaconda3/lib/python3.7/site-packages/mmdet-2.1.0+8f3868f-py3.7-linux-x86_64.egg/mmdet/datasets/dotav1.py", line 187, in evaluate
logger=logger)
File "/home/dl/anaconda3/lib/python3.7/site-packages/mmdet-2.1.0+8f3868f-py3.7-linux-x86_64.egg/mmdet/core/evaluation/rmean_ap.py", line 196, in reval_map
num_classes = len(det_results[0]) # positive class num
IndexError: list index out of range

@houliping
Copy link

Have you solved this problem?

@seacloud-0420
Copy link

Hi,@why228430
I also encountered this problem. Have you solved your problem?

@PuyangChen
Copy link

I also encountered this problem. And I have checked the class num repeatedly. Have you solved your problem?

@tjmannn
Copy link

tjmannn commented Mar 30, 2021

same problem, i met this when just finishing the first epoch

@PuyangChen
Copy link

same problem, i met this when just finishing the first epoch

I met the same problem before. Now, I have already fixed it.

Error: num_classes = len(det_results[0]) # positive class num

My problem is due to the det_results is an empty list, because the test.txt is empty. After training the first epoch, there are no data to validate.
So it returns the error: list index out of range.
I hope it could help those who encounter the same problem.

@colorfully-ybf
Copy link

In my ieda,it's maybe the error of dataset

@HeHuasu
Copy link

HeHuasu commented Jun 18, 2023

same problem, i met this when just finishing the first epoch

I met the same problem before. Now, I have already fixed it.

Error: num_classes = len(det_results[0]) # positive class num

My problem is due to the det_results is an empty list, because the test.txt is empty. After training the first epoch, there are no data to validate. So it returns the error: list index out of range. I hope it could help those who encounter the same problem.

Sorry, I don't quite understand this error. If I want to fix this error, do I need to add the relevant files?

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

7 participants