Megvii-BaseDetection / YOLOX

YOLOX is a high-performance anchor-free YOLO, exceeding yolov3~v5 with MegEngine, ONNX, TensorRT, ncnn, and OpenVINO supported. Documentation: https://yolox.readthedocs.io/
Apache License 2.0
9.35k stars 2.19k forks source link

I got this error when running the eval.py on google colab :( I had replaced the pretrained model with the best_ckpt.pth but this failure still happened :( #1735

Open bachdaohuu opened 10 months ago

bachdaohuu commented 10 months ago

) 2023-11-16 02:38:49 | INFO | yolox.data.datasets.coco:63 - loading annotations into memory... 2023-11-16 02:38:49 | INFO | yolox.data.datasets.coco:63 - Done (t=0.00s) 2023-11-16 02:38:49 | INFO | pycocotools.coco:86 - creating index... 2023-11-16 02:38:49 | INFO | pycocotools.coco:86 - index created! /usr/local/lib/python3.10/dist-packages/torch/utils/data/dataloader.py:557: UserWarning: This DataLoader will create 4 worker processes in total. Our suggested max number of worker in current system is 2, which is smaller than what this DataLoader is going to create. Please be aware that excessive worker creation might get DataLoader running slow or even freeze, lower the worker number to avoid potential slowness/freeze if necessary. warnings.warn(_create_warning_msg( 2023-11-16 02:38:49 | INFO | main:165 - loading checkpoint from yolox_s.pth 2023-11-16 02:38:51 | INFO | main:169 - loaded checkpoint done. 2023-11-16 02:38:51 | INFO | main:175 - Fusing model... /usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py:844: UserWarning: The .grad attribute of a Tensor that is not a leaf Tensor is being accessed. Its .grad attribute won't be populated during autograd.backward(). If you indeed want the .grad field to be populated for a non-leaf Tensor, use .retain_grad() on the non-leaf Tensor. If you access the non-leaf Tensor by mistake, make sure you access the leaf Tensor instead. See github.com/pytorch/pytorch/pull/30531 for more informations. (Triggered internally at aten/src/ATen/core/TensorBody.h:489.) if param.grad is not None: 20% 3/15 [00:08<00:32, 2.75s/it] 2023-11-16 02:39:00 | ERROR | yolox.core.launch:98 - An error has been caught in function 'launch', process 'MainProcess' (10067), thread 'MainThread' (135023614169728): Traceback (most recent call last):

File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, │ │ └ {'name': 'main', 'doc': None, 'package': 'yolox.tools', 'loader': <_frozen_importlib_external.SourceFileL... │ └ <code object at 0x7acda23398f0, file "/content/drive/MyDrive/YOLOX/tools/eval.py", line 1> └ <function _run_code at 0x7acda22e60e0> File "/usr/lib/python3.10/runpy.py", line 86, in _run_code exec(code, run_globals) │ └ {'name': 'main', 'doc': None, 'package': 'yolox.tools', 'loader': <_frozen_importlib_external.SourceFileL... └ <code object at 0x7acda23398f0, file "/content/drive/MyDrive/YOLOX/tools/eval.py", line 1>

File "/content/drive/MyDrive/YOLOX/tools/eval.py", line 212, in launch( └ <function launch at 0x7accf80800d0>

File "/content/drive/MyDrive/YOLOX/yolox/core/launch.py", line 98, in launch main_func(*args) │ └ (╒═══════════════════╤══════════════════════════════════════════════════════════════════════════════════════════════╕ │ │ keys ... └ <function main at 0x7accfa118b80>

File "/content/drive/MyDrive/YOLOX/tools/eval.py", line 193, in main *_, summary = evaluator.evaluate( │ └ <function COCOEvaluator.evaluate at 0x7acce8f09ab0> └ <yolox.evaluators.coco_evaluator.COCOEvaluator object at 0x7acce8dc46a0>

File "/content/drive/MyDrive/YOLOX/yolox/evaluators/coco_evaluator.py", line 184, in evaluate data_list_elem, image_wise_data = self.convert_to_coco_format( │ │ └ <function COCOEvaluator.convert_to_coco_format at 0x7acce8f09b40> │ └ <yolox.evaluators.coco_evaluator.COCOEvaluator object at 0x7acce8dc46a0> └ [{'image_id': 16, 'category_id': 1, 'bbox': [189.125, 197.875, 22.5, 12.0], 'score': 0.9371018409729004, 'segmentation': []},...

File "/content/drive/MyDrive/YOLOX/yolox/evaluators/coco_evaluator.py", line 231, in convert_to_coco_format "categories": [

File "/content/drive/MyDrive/YOLOX/yolox/evaluators/coco_evaluator.py", line 232, in self.dataloader.dataset.class_ids[int(cls[ind])] │ │ │ │ │ └ 20 │ │ │ │ └ tensor([ 2., 2., 2., 2., 2., 2., 2., 1., 2., 2., 2., 2., 2., 2., │ │ │ │ 2., 2., 2., 2., 2., 2., 36., 2.,... │ │ │ └ [0, 1, 2] │ │ └ <yolox.data.datasets.coco.COCODataset object at 0x7acce8eff040> │ └ <torch.utils.data.dataloader.DataLoader object at 0x7acce8efd720> └ <yolox.evaluators.coco_evaluator.COCOEvaluator object at 0x7acce8dc46a0>

IndexError: list index out of range

dhhdjsmsl commented 10 months ago

same problem ! have you solved this question?

bkornpob-sertiscorp commented 1 month ago

Try this

Please let me know if this fixes the problem. It fixed mine.