Issue with AssertionError during Runtime
Opened this issue · 3 comments
Hello,
I encountered an error when running the command "python train-det.py ./configs/perception-types.py." The error message is as follows: AssertionError: train_cfg specified in both the outer field and model field.
After reviewing the code, I initially attempted to address the issue by commenting out the assert code. However, this led to a new error: TypeError: RetinaNet: init() got an unexpected keyword argument 'data_preprocessor.'
My runtime environment includes Python 3.8, PyTorch version 1.9.1, mmcv-full version 1.7.2, and mmdet version 2.28.0.
Despite thorough code inspection, I have been unable to resolve the problem. Could you provide assistance in finding a solution? Your help is greatly appreciated!
Thanks in advance.
Hi Xiaohuahuaw,
Thank you for taking an interest in our work and informing us of errors you encountered.
I run the code again and it works for me.
You should download libra_retinanet_r50_fpn_1x_coco.py (save it to ./perception/) and libra_retinanet_r50_fpn_1x_coco_20200205-804d94ce.pth (save it to ./perception/configs). I guess you can find both files in https://github.com/open-mmlab/mmdetection/tree/master/configs/libra_rcnn. You may also try other backbones as mmdetection provides various pre-trained models.
Here are the versions of some important packages we use, can you try again and let me know if you still have the same error?
Hi Xiaohuahuaw,
Thank you for taking an interest in our work and informing us of errors you encountered.
I run the code again and it works for me.
You should download libra_retinanet_r50_fpn_1x_coco.py (save it to ./perception/) and libra_retinanet_r50_fpn_1x_coco_20200205-804d94ce.pth (save it to ./perception/configs). I guess you can find both files in https://github.com/open-mmlab/mmdetection/tree/master/configs/libra_rcnn. You may also try other backbones as mmdetection provides various pre-trained models.
Here are the versions of some important packages we use, can you try again and let me know if you still have the same error?
Thank you for your detailed response!
I have followed the steps you mentioned to download and configure the libra_retinanet_r50_fpn_1x_coco.py and libra_retinanet_r50_fpn_1x_coco_20200205-804d94ce.pth files. (actually, I had downloaded them earlier). Additionally, I have updated mmcv and mmdet to the versions you provided. However, I still encounter the same error. Specifically, when running the "python train-det.py ./configs/perception-types.py" command, I still receive the following error message: AssertionError: train_cfg specified in both the outer field and model field.
Is there any other possible solution or advice you could provide? Thank you for your assistance!
Thanks for your error report and we appreciate it a lot.
We haven't encountered this error in our experiments before, but I guess you can try to comment out lines 172-173 in train-det.py.
According to the source code, such an error occurs when both cfg.get('train_cfg') and train_cfg are given when we use the function build_detector(cfg, train_cfg=None, test_cfg=None).
Since we already indicate the train_cfg and test_cfg of model in ./configs/perception-types.py, there is no need to input train_cfg and test_cfg when we use the build_detector() function.
Hence I guess this error might be solved by commenting out lines 172-173 in train-det.py.
Let me know if you still have other errors.