Closed FirasKedidi closed 3 years ago
It seems your len of your inference output is 0. In my situation, the len of results is equal to num_images. Can you show the full log when you execute the code? Maybe you don't inference any image in your test.
It seems your len of your inference output is 0. In my situation, the len of results is equal to num_images. Can you show the full log when you execute the code? Maybe you don't inference any image in your test.
This is the error log i faced this problem before also when i was working with google colab and i couldn't solve it. I've used inference_detector() function and it worked fine. I think that the inference is done but the problem is in saving the result because the error is the result2json function.
/home/ranim/Documents/mmdet/mmdetection/tools/test.py:101: UserWarning: --options is deprecated in favor of --eval-options warnings.warn('--options is deprecated in favor of --eval-options') loading annotations into memory... Done (t=0.01s) creating index... index created! /home/ranim/Documents/mmdet/mmdetection/mmdet/core/anchor/builder.py:15: UserWarning: ``build_anchor_generator`` would be deprecated soon, please use ``build_prior_generator`` warnings.warn( Use load_from_local loader completed: 0, elapsed: 0sTraceback (most recent call last): File "/home/ranim/Documents/mmdet/mmdetection/tools/test.py", line 237, in <module> main() File "/home/ranim/Documents/mmdet/mmdetection/tools/test.py", line 219, in main dataset.format_results(outputs, **kwargs) File "/home/ranim/Documents/mmdet/mmdetection/mmdet/datasets/coco.py", line 345, in format_results result_files = self.results2json(results, jsonfile_prefix) File "/home/ranim/Documents/mmdet/mmdetection/mmdet/datasets/coco.py", line 276, in results2json if isinstance(results[0],list): IndexError: list index out of range
It seems your len of your inference output is 0. In my situation, the len of results is equal to num_images. Can you show the full log when you execute the code? Maybe you don't inference any image in your test.
Also forgot to mention the annotation file for the test data is empty it contains only the categories and the test data contains only one image.
Hello, I just referred to an older question and it turned out that the problem is from the annotation file i only included the categories and not the images: ids and file_names that's why he was giving me the error. Thank you for your help. #5548
Thanks for your error report and we appreciate it a lot.
Checklist
Describe the bug list index out of range
Reproduction
Did you make any modifications on the code or config? Did you understand what you have modified? I used the coco dataset. I changed the classes and num_classes in the config file
What dataset did you use? Custom dataset Environment
Please run
python mmdet/utils/collect_env.py
to collect necessary environment information and paste it here.You may add addition that may be helpful for locating the problem, such as
$PATH
,$LD_LIBRARY_PATH
,$PYTHONPATH
, etc.)Error traceback If applicable, paste the error trackback here.
Bug fix If you have already identified the reason, you can provide the information here. If you are willing to create a PR to fix it, please also leave a comment here and that would be much appreciated!