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

TypeError: build_dataloader() missing 1 required positional argument: 'samples_per_gpu #10

Open cmtsai opened 4 years ago

cmtsai commented 4 years ago

Thanks for sharing your research/code with us. Many appreciated. I tried to run: python tools/test.py configs/D2Det/D2Det_instance_r101_fpn_2x.py checkpoints/D2Det-instance-res101.pth --show loading annotations into memory... Done (t=0.50s) creating index... index created! Traceback (most recent call last): File "tools/test.py", line 175, in main() File "tools/test.py", line 136, in main shuffle=False) TypeError: build_dataloader() missing 1 required positional argument: 'samples_per_gpu'

How to solve the is problem?

JialeCao001 commented 4 years ago

Do you update mmdetection version?

cmtsai commented 4 years ago

I use mmdetection master version. However, it produce above-mentioned problem.

I use https://github.com/open-mmlab/mmdetection/pull/2404 : Rename imgs_per_gpu to samples_per_gpu to rename.

However, it produce as follows: python tools/test.py configs/D2Det/D2Det_instance_r101_fpn_2x.py checkpoints/D2Det-instance-res101.pth --show Traceback (most recent call last): File "tools/test.py", line 9, in from mmdet.apis import multi_gpu_test, single_gpu_test File "/home/user/2TB/D2Det/mmdet/init.py", line 1, in from .version import version, short_version ModuleNotFoundError: No module named 'mmdet.version'

How to solve the is problem?

JialeCao001 commented 4 years ago

Hi, cmtsai. I donot see 'samples_per_gpu' from L131 to L136 in test.py. Please check it as follows. https://github.com/JialeCao001/D2Det/blob/aba3d2d177a7df402bffe1beb2394be44dd3bd8c/tools/test.py#L131

cmtsai commented 4 years ago

Hi, JialeCao. I try to download your D2Det code again. And execute python tools/test.py configs/D2Det/D2Det_instance_r101_fpn_2x.py checkpoints/D2Det-instance-res101.pth --show Traceback (most recent call last): File "tools/test.py", line 9, in from mmdet.apis import multi_gpu_test, single_gpu_test File "/home/user/2TB/D2Det/mmdet/init.py", line 1, in from .version import version, short_version ModuleNotFoundError: No module named 'mmdet.version'

How to solve the is problem?

JialeCao001 commented 4 years ago

You should compile this project. Please refer to https://github.com/JialeCao001/D2Det/blob/master/docs/INSTALL.md.

cmtsai commented 4 years ago

Hi, JialeCao, I have compiled this project which follows https://github.com/JialeCao001/D2Det/blob/master/docs/INSTALL.md.

However, when run python tools/test.py configs/D2Det/D2Det_instance_r101_fpn_2x.py checkpoints/D2Det-instance-res101.pth --show Traceback (most recent call last): File "tools/test.py", line 9, in from mmdet.apis import multi_gpu_test, single_gpu_test File "/home/user/2TB/D2Det/mmdet/apis/init.py", line 1, in from .inference import (async_inference_detector, inference_detector, File "/home/user/2TB/D2Det/mmdet/apis/inference.py", line 11, in from mmdet.core import get_classes File "/home/user/2TB/D2Det/mmdet/core/init.py", line 7, in from .post_processing import * # noqa: F401, F403 File "/home/user/2TB/D2Det/mmdet/core/post_processing/init.py", line 1, in from .bbox_nms import multiclass_nms, multiclass_nms1 File "/home/user/2TB/D2Det/mmdet/core/post_processing/bbox_nms.py", line 3, in from mmdet.ops.nms import nms_wrapper File "/home/user/2TB/D2Det/mmdet/ops/init.py", line 2, in from .dcn import (DeformConv, DeformConvPack, DeformRoIPooling, File "/home/user/2TB/D2Det/mmdet/ops/dcn/init.py", line 1, in from .deform_conv import (DeformConv, DeformConvPack, ModulatedDeformConv, File "/home/user/2TB/D2Det/mmdet/ops/dcn/deform_conv.py", line 10, in from . import deform_conv_cuda ImportError: cannot import name 'deform_conv_cuda' from 'mmdet.ops.dcn' (/home/user/2TB/D2Det/mmdet/ops/dcn/init.py)

How to solve this problem?

JialeCao001 commented 4 years ago

do you run the command 'pip install -v -e . # or "python setup.py develop"'?

cmtsai commented 4 years ago

My steps are described as follows:

  1. Download your code from https://github.com/JialeCao001/D2Det.
  2. (open-mmlab) user@gpu:~/2TB/D2Det$ pip install -r requirements/build.txt
  3. (open-mmlab) user@gpu:~/2TB/D2Det$ pip install "git+https://github.com/open-mmlab/cocoapi.git#subdirectory=pycocotools"
  4. (open-mmlab) user@gpu:~/2TB/D2Det$ pip install -v -e .
  5. (open-mmlab) user@gpu:~/2TB/D2Det$ python tools/test.py configs/D2Det/D2Det_instance_r101_fpn_2x.py checkpoints/D2Det-instance-res101.pth --show and produce error: Traceback (most recent call last): File "tools/test.py", line 9, in from mmdet.apis import multi_gpu_test, single_gpu_test File "/home/user/2TB/D2Det/mmdet/apis/init.py", line 1, in from .inference import (async_inference_detector, inference_detector, File "/home/user/2TB/D2Det/mmdet/apis/inference.py", line 11, in from mmdet.core import get_classes File "/home/user/2TB/D2Det/mmdet/core/init.py", line 7, in from .post_processing import * # noqa: F401, F403 File "/home/user/2TB/D2Det/mmdet/core/post_processing/init.py", line 1, in from .bbox_nms import multiclass_nms, multiclass_nms1 File "/home/user/2TB/D2Det/mmdet/core/post_processing/bbox_nms.py", line 3, in from mmdet.ops.nms import nms_wrapper File "/home/user/2TB/D2Det/mmdet/ops/init.py", line 2, in from .dcn import (DeformConv, DeformConvPack, DeformRoIPooling, File "/home/user/2TB/D2Det/mmdet/ops/dcn/init.py", line 1, in from .deform_conv import (DeformConv, DeformConvPack, ModulatedDeformConv, File "/home/user/2TB/D2Det/mmdet/ops/dcn/deform_conv.py", line 10, in from . import deform_conv_cuda ImportError: cannot import name 'deform_conv_cuda' from 'mmdet.ops.dcn' (/home/user/2TB/D2Det/mmdet/ops/dcn/init.py)

Are these steps wrong?

JialeCao001 commented 4 years ago

Hi, cmtsai. I am not sure what is the problem. I feel that the project is not sucessfully installed. Please check the following things: (1) Is the command "pip install -v -e ." sucessfully finished or not. (2) Maybe using conda is better. I usually install the project in conda environment as stated in INSTALL.MD.