JialeCao001 / D2Det

D2Det: Towards High Quality Object Detection and Instance Segmentation (CVPR2020)
https://openaccess.thecvf.com/content_CVPR_2020/papers/Cao_D2Det_Towards_High_Quality_Object_Detection_and_Instance_Segmentation_CVPR_2020_paper.pdf
MIT License
297 stars 86 forks source link

ModuleNotFoundError: No module named 'mmdet.version' #11

Open yeohunyun opened 3 years ago

yeohunyun commented 3 years ago

hello ,

thank you for the repo.

when i train the model, i just got the error like "Traceback (most recent call last): File "train.py", line 15, in from mmdet import version File "/home/adasone/yeohun/D2Det/tools/../mmdet/init.py", line 1, in from .version import version, short_version ModuleNotFoundError: No module named 'mmdet.version' "

how can i fix it ?

Thanks.

JialeCao001 commented 3 years ago

@yeohunyun Hi. It seems the enviroment problem. I use pytorch1.1.0, cuda9.0/10.0, and mmcv0.4.3. You can use this setting to try it again.

yeohunyun commented 3 years ago

Thank you for replying

i fixed the error in training

but, i got the error in test like loading annotations into memory... Done (t=0.00s) creating index... index created! [ ] 0/114, elapsed: 0s, ETA:Traceback (most recent call last): File "tools/test.py", line 179, in main() File "tools/test.py", line 157, in main outputs = single_gpu_test(model, data_loader, args.show) File "/home/adasone/yeohun/D2Det/tools/../mmdet/apis/test.py", line 19, in single_gpu_test result = model(return_loss=False, rescale=not show, data) File "/home/adasone/kdk/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in call result = self.forward(*input, *kwargs) File "/home/adasone/kdk/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 140, in forward return self.module(inputs, kwargs) File "/home/adasone/kdk/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in call result = self.forward(*input, kwargs) File "/home/adasone/yeohun/D2Det/tools/../mmdet/core/fp16/decorators.py", line 49, in new_func return old_func(*args, kwargs) File "/home/adasone/yeohun/D2Det/tools/../mmdet/models/detectors/base.py", line 139, in forward return self.forward_test(img, img_meta, kwargs) File "/home/adasone/yeohun/D2Det/tools/../mmdet/models/detectors/base.py", line 122, in forward_test return self.simple_test(imgs[0], img_metas[0], *kwargs) File "/home/adasone/yeohun/D2Det/tools/../mmdet/models/detectors/D2Det.py", line 250, in simple_test x = self.extract_feat(img) File "/home/adasone/yeohun/D2Det/tools/../mmdet/models/detectors/two_stage.py", line 91, in extract_feat x = self.backbone(img) File "/home/adasone/kdk/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in call result = self.forward(input, kwargs) File "/home/adasone/yeohun/D2Det/tools/../mmdet/models/backbones/resnet.py", line 504, in forward x = res_layer(x) File "/home/adasone/kdk/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in call result = self.forward(*input, kwargs) File "/home/adasone/kdk/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/nn/modules/container.py", line 92, in forward input = module(input) File "/home/adasone/kdk/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in call result = self.forward(*input, *kwargs) File "/home/adasone/yeohun/D2Det/tools/../mmdet/models/backbones/resnet.py", line 236, in forward out = _inner_forward(x) File "/home/adasone/yeohun/D2Det/tools/../mmdet/models/backbones/resnet.py", line 213, in _inner_forward out = self.conv2(out) File "/home/adasone/kdk/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in call result = self.forward(input, kwargs) File "/home/adasone/yeohun/D2Det/tools/../mmdet/ops/dcn/deform_conv.py", line 403, in forward self.groups, self.deformable_groups) File "/home/adasone/yeohun/D2Det/tools/../mmdet/ops/dcn/deform_conv.py", line 137, in forward raise NotImplementedError NotImplementedError

how to fix it..?

thanks.

JialeCao001 commented 3 years ago

@yeohunyun Hi. It is difficult for me to give a detailed accurate reason about this problem. It seems that the backbone with deformable convolution has an error. But I am not sure why it is wrong during testing and okay during training. Could you provide more details about the training and testing, e.g., the commands of training and testing. Do you train the detector using your own datasets?

ma3252788 commented 3 years ago

hello ,

thank you for the repo.

when i train the model, i just got the error like "Traceback (most recent call last): File "train.py", line 15, in from mmdet import version File "/home/adasone/yeohun/D2Det/tools/../mmdet/init.py", line 1, in from .version import version, short_version ModuleNotFoundError: No module named 'mmdet.version' "

how can i fix it ?

Thanks.

How did you solve this problem? I also have this problem

JialeCao001 commented 3 years ago

@ma3252788 I think that the reason is that the project is not compiled sucessfully. I use pytorch1.1.0, cuda9.0/10.0, and mmcv0.4.3. You can try it again with my settings.

ma3252788 commented 3 years ago

@ma3252788 I think that the reason is that the project is not compiled sucessfully. I use pytorch1.1.0, cuda9.0/10.0, and mmcv0.4.3. You can try it again with my settings.

Thank you for your reply. I have been trying to install the environment all day today, but failed. Could you please provide me with more detailed environment Settings? For example, the version of MMdetction, if you are using Anaconda, can you share the YML file of Conda?

JialeCao001 commented 3 years ago

@ma3252788 I think that you maybe have some inaccurate understanding. In fact, you do not need to download an extra mmdetection, because our D2Det contains mmdetection. Just download our D2Det and treat it as a mmdetection project. Using pytorch1.1.0, cuda9.0/10.0, and mmcv0.4.3 to compile it under a new conda enviroment.

ma3252788 commented 3 years ago

@ma3252788 I think that you maybe have some inaccurate understanding. In fact, you do not need to download an extra mmdetection, because our D2Det contains mmdetection. Just download our D2Det and treat it as a mmdetection project. Using pytorch1.1.0, cuda9.0/10.0, and mmcv0.4.3 to compile it under a new conda enviroment.

@JialeCao001 I see what you mean. I'll have a try.

ma3252788 commented 3 years ago

@ma3252788 I think that you maybe have some inaccurate understanding. In fact, you do not need to download an extra mmdetection, because our D2Det contains mmdetection. Just download our D2Det and treat it as a mmdetection project. Using pytorch1.1.0, cuda9.0/10.0, and mmcv0.4.3 to compile it under a new conda enviroment.

I'm sorry to bother you. I tried to use mmdet directly, and then I will prompt ModuleNo. Finderror: No Module Named' mmdet. Version', then I compiled other mmdetection, copied the version.py into mmdet, and then I can continue running. However, the error importerror: cannot import name' deform _ conv _ cuda'appeared later. Do you know the reason?

ma3252788 commented 3 years ago

@ma3252788 I think that you maybe have some inaccurate understanding. In fact, you do not need to download an extra mmdetection, because our D2Det contains mmdetection. Just download our D2Det and treat it as a mmdetection project. Using pytorch1.1.0, cuda9.0/10.0, and mmcv0.4.3 to compile it under a new conda enviroment.

@JialeCao001 I have rebuilt a virtual environment, and my orders are as follows: conda create -n d2 Python=3.6 conda activate d2 conda install pytorch=1.1.0=cuda100py36he554f03_0 pip install mmcv==0.4.3

And then the question would come up.https://github.com/JialeCao001/D2Det/issues/11#issuecomment-691399410

JialeCao001 commented 3 years ago

@ma3252788 I think that you maybe have some inaccurate understanding. In fact, you do not need to download an extra mmdetection, because our D2Det contains mmdetection. Just download our D2Det and treat it as a mmdetection project. Using pytorch1.1.0, cuda9.0/10.0, and mmcv0.4.3 to compile it under a new conda enviroment.

I'm sorry to bother you. I tried to use mmdet directly, and then I will prompt ModuleNo. Finderror: No Module Named' mmdet. Version', then I compiled other mmdetection, copied the version.py into mmdet, and then I can continue running. However, the error importerror: cannot import name' deform _ conv _ cuda'appeared later. Do you know the reason?

@ma3252788 I am afraid that this code does not support new mmdetection. If you want to use new mmdetection, maybe you can copy the files of D2Det to that project.

ma3252788 commented 3 years ago

@ma3252788 I think that you maybe have some inaccurate understanding. In fact, you do not need to download an extra mmdetection, because our D2Det contains mmdetection. Just download our D2Det and treat it as a mmdetection project. Using pytorch1.1.0, cuda9.0/10.0, and mmcv0.4.3 to compile it under a new conda enviroment.

I'm sorry to bother you. I tried to use mmdet directly, and then I will prompt ModuleNo. Finderror: No Module Named' mmdet. Version', then I compiled other mmdetection, copied the version.py into mmdet, and then I can continue running. However, the error importerror: cannot import name' deform _ conv _ cuda'appeared later. Do you know the reason?

@ma3252788 I am afraid that this code does not support new mmdetection. If you want to use new mmdetection, maybe you can copy the files of D2Det to that project.

@JialeCao001 No, I didn't want to use the new mmdetection. When I run this code, It will prompt ModuleNotFoundError: No module named 'mmdet.version' , So, I recompiled a version.py

ma3252788 commented 3 years ago

@ma3252788 I think that you maybe have some inaccurate understanding. In fact, you do not need to download an extra mmdetection, because our D2Det contains mmdetection. Just download our D2Det and treat it as a mmdetection project. Using pytorch1.1.0, cuda9.0/10.0, and mmcv0.4.3 to compile it under a new conda enviroment.

I'm sorry to bother you. I tried to use mmdet directly, and then I will prompt ModuleNo. Finderror: No Module Named' mmdet. Version', then I compiled other mmdetection, copied the version.py into mmdet, and then I can continue running. However, the error importerror: cannot import name' deform _ conv _ cuda'appeared later. Do you know the reason?

@ma3252788 I am afraid that this code does not support new mmdetection. If you want to use new mmdetection, maybe you can copy the files of D2Det to that project.

conda create -n d2 Python=3.6
conda activate d2
conda install pytorch=1.1.0=cuda100py36he554f03_0
pip install mmcv==0.4.3
python ./demo/D2Det_demo.py ./configs/D2Det/D2Det_instance_r101_fpn_2x.py ./D2Det-instance-res101.pth ./demo/demo.jpg --out ./demo/aa.jpg

Is this the right step for me? Is there anything missing?

JialeCao001 commented 3 years ago

Do you compile this project sucessfully? Using the command: pip install -v -e . or python setup.py develop.

ma3252788 commented 3 years ago

Do you compile this project sucessfully? Using the command: pip install -v -e . or python setup.py develop.

Thank you very much. Now it works!!! Thank you!! I'm sorry I didn't find this command in the installation guide.

poornaprudhvigu-kore commented 2 years ago

One of the reasons could be you are using a cpu machine. Please check if cuda is available. Some versions of mmdet only compiles on GPU.