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.4k stars 2.2k forks source link

Index out of dimension #1165

Open 1311523821 opened 2 years ago

1311523821 commented 2 years ago

2022-03-08 10:36:48 | ERROR | yolox.core.launch:98 - An error has been caught in function 'launch', process 'MainProcess' (19640), thread 'MainThread' (668): Traceback (most recent call last):

File "d:/Studies/bhdx/CODE/YOLOX-0.2.0/tools\train.py", line 126, in launch( └ <function launch at 0x000001B5640BC0D0>

File "D:\Studies\bhdx\CODE\YOLOX-0.2.0\yolox\core\launch.py", line 98, in launch main_func(*args) │ └ (╒══════════════════╤════════════════════════════════════════════════════════════════════════════════════════════════════════... └ <function main at 0x000001B56659FAF0>

File "d:/Studies/bhdx/CODE/YOLOX-0.2.0/tools\train.py", line 111, in main trainer.train() │ └ <function Trainer.train at 0x000001B56577CF70> └ <yolox.core.trainer.Trainer object at 0x000001B5665AA520>

File "D:\Studies\bhdx\CODE\YOLOX-0.2.0\yolox\core\trainer.py", line 70, in train self.before_train() │ └ <function Trainer.before_train at 0x000001B56659DD30> └ <yolox.core.trainer.Trainer object at 0x000001B5665AA520>

File "D:\Studies\bhdx\CODE\YOLOX-0.2.0\yolox\core\trainer.py", line 133, in before_train "Model Summary: {}".format(get_model_info(model, self.exp.test_size)) │ │ │ │ └ (640, 640) │ │ │ └ ╒══════════════════╤═════════════════════════════════════════════════════════════════════════════════════════════════════════... │ │ └ <yolox.core.trainer.Trainer object at 0x000001B5665AA520> │ └ YOLOX( │ (backbone): YOLOPAFPN( │ (backbone): CSPDarknet( │ (stem): Focus( │ (conv): BaseConv( │ (conv): ... └ <function get_model_info at 0x000001B561E835E0>

File "D:\Studies\bhdx\CODE\YOLOX-0.2.0\yolox\utils\model_utils.py", line 23, in get_model_info flops, params = profile(deepcopy(model), inputs=(img,), verbose=False) │ │ │ └ tensor([[[[0., 0., 0., ..., 0., 0., 0.], │ │ │ [0., 0., 0., ..., 0., 0., 0.], │ │ │ [0., 0., 0., ..., 0., 0., 0.],... │ │ └ YOLOX( │ │ (backbone): YOLOPAFPN( │ │ (backbone): CSPDarknet( │ │ (stem): Focus( │ │ (conv): BaseConv( │ │ (conv): ... │ └ <function deepcopy at 0x000001B55ABC0310> └ <function profile at 0x000001B561E944C0>

File "D:\Studies\Anaconda3\envs\pytorch\lib\site-packages\thop\profile.py", line 211, in profile model(*inputs) │ └ (tensor([[[[0., 0., 0., ..., 0., 0., 0.], │ [0., 0., 0., ..., 0., 0., 0.], │ [0., 0., 0., ..., 0., 0., 0.]... └ YOLOX( (backbone): YOLOPAFPN( (backbone): CSPDarknet( (stem): Focus( (conv): BaseConv( (conv): ...

File "D:\Studies\Anaconda3\envs\pytorch\lib\site-packages\torch\nn\modules\module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) │ │ └ {} │ └ (tensor([[[[0., 0., 0., ..., 0., 0., 0.], │ [0., 0., 0., ..., 0., 0., 0.], │ [0., 0., 0., ..., 0., 0., 0.]... └ <bound method YOLOX.forward of YOLOX( (backbone): YOLOPAFPN( (backbone): CSPDarknet( (stem): Focus( (conv...

File "D:\Studies\bhdx\CODE\YOLOX-0.2.0\yolox\models\yolox.py", line 30, in forward │ │ │ [0., 0., 0., 0.]], │ │ │ │ │ │ [[... │ │ └ tensor([0.], dtype=torch.float64) │ └ <built-in method cat of type object at 0x00007FF9B6FB3590> └ <module 'torch' from 'D:\Studies\Anaconda3\envs\pytorch\lib\site-packages\torch\init.py'>

IndexError: Dimension out of range (expected to be in range of [-1, 0], but got 1)

FateScript commented 2 years ago

Did you modify any code in YOLOX ? What's your thop and torch version?

1311523821 commented 2 years ago

Did you modify any code in YOLOX ? What's your thop and torch version?

I modified the parameters of parser default,such as: parser.add_argument("-b", "--batch-size", type=int, default=4, help="batch size") parser.add_argument("-d", "--devices", default=1, type=int, help="device for training") parser.add_argument( "-f", "--exp_file", default='exps\example\yolox_voc\yolox_voc_s.py', type=str, help="plz input your experiment description file", )

voc_classes.py modify 'VOC_CLASSES =()' yolox_voc_s.py modify 'self.num_classes = 6'

Name Version Build Channel

thop 0.0.5-2203072204 pypi_0 pypi pytorch 1.10.1 py3.8_cuda10.2_cudnn7_0 pytorch