Sense-X / Co-DETR

[ICCV 2023] DETRs with Collaborative Hybrid Assignments Training
MIT License
968 stars 105 forks source link

An error occurred while exporting the learned model to onnx. (mmdet module 'mmdet' has no attribute 'datasets') #87

Closed yeong-ha-kim closed 10 months ago

yeong-ha-kim commented 10 months ago

To export the model trained on the custom dataset to onnx, I created a new conda virtual environment and installed the library. I am getting the following error while creating onnx model:

tools/deployment/pytorch2onnx.py:283: UserWarning: Arguments like --mean, --std, --dataset would be parsed directly from config file and are deprecated and will be removed in future releases. warnings.warn('Arguments like --mean, --std, --dataset would be \ Traceback (most recent call last): File "tools/deployment/pytorch2onnx.py", line 295, in cfg = Config.fromfile(args.config) File "/root/anaconda3/envs/openmmlab/lib/python3.8/site-packages/mmcv/utils/config.py", line 331, in fromfile cfg_dict, cfg_text = Config._file2dict(filename, File "/root/anaconda3/envs/openmmlab/lib/python3.8/site-packages/mmcv/utils/config.py", line 248, in _file2dict _cfg_dict, _cfg_text = Config._file2dict(osp.join(cfg_dir, f)) File "/root/anaconda3/envs/openmmlab/lib/python3.8/site-packages/mmcv/utils/config.py", line 206, in _file2dict mod = import_module(temp_module_name) File "/root/anaconda3/envs/openmmlab/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "", line 843, in exec_module File "", line 219, in _call_with_frames_removed File "/tmp/tmpiiacxlkk/tmp3391dyu0.py", line 2, in AttributeError: module 'mmdet' has no attribute 'datasets' Exception ignored in: <function _TemporaryFileCloser.del at 0x7f51fa0daa60> Traceback (most recent call last): File "/root/anaconda3/envs/openmmlab/lib/python3.8/tempfile.py", line 440, in del self.close() File "/root/anaconda3/envs/openmmlab/lib/python3.8/tempfile.py", line 436, in close unlink(self.name) FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpiiacxlkk/tmp3391dyu0.py'

I configured the virtual environment by referring to the tutorial.

The libraries installed to configure the virtual environment are:

python==3.8 CUDA == 11.3 pip install torch==1.9.1 torchvision==0.10.1 pip install "mmcv-full==1.3.17" -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.9.1/index.html pip install onnx onnxruntime-gpu (onnx : 1.15.0, onnxruntime-gpu : 1.16.2) mim install mmdet==2.25.3 pip install fairscale

I installed mmcv and mmdet by referring to the URL below, but datasets cannot be found. https://github.com/Sense-X/Co-DETR/blob/main/docs/en/faq.md

TempleX98 commented 10 months ago

Sorry, this repo does not support model export of Co-DETR. Please refer to https://github.com/Sense-X/Co-DETR/issues/26#issuecomment-1748803687 for more details.