mmdetection icon indicating copy to clipboard operation
mmdetection copied to clipboard

[Bug] flops get wrong :'BatchNorm2d' object has no attribute '__flops__'

Open jimuIee opened this issue 2 years ago • 2 comments

Prerequisite

Task

I'm using the official example scripts/configs for the officially supported tasks/models/datasets.

Branch

master branch https://github.com/open-mmlab/mmdetection

Environment

mmcls 0.23.2 mmcv-full 1.5.0 mmdet 2.25.1 anaconda3/envs/openmmlab/lib/python3.8/site-packages/mmdet-2.25.1-py3.8.egg model-index 0.1.11 nest-asyncio 1.5.5 networkx 2.8.7

Reproduces the problem - code sample

self.bn = nn.BatchNorm2d(channels) i have add a new class in fpn.py and this new class hac include nn.BatchNorm2d

Reproduces the problem - command or script

python tools/analysis_tools/get_flops.py work_dirs/gfl_r50_fpn_1x_coco_res101/gfl_r50_fpn_1x_coco.py

Reproduces the problem - error message

'BatchNorm2d' object has no attribute 'flops'

Additional information

No response

jimuIee avatar Dec 06 '22 09:12 jimuIee

@jimuIee Can you check if the official configuration provided is working? For example python tools/analysis_tools/get_flops.py configs/gfl/gfl_r50_fpn_1x_coco.py

hhaAndroid avatar Dec 12 '22 09:12 hhaAndroid

@jimuIee Can you check if the official configuration provided is working? For example python tools/analysis_tools/get_flops.py configs/gfl/gfl_r50_fpn_1x_coco.py

YES the official config can working normally,but why did i add a "nn.batchnorm2d"made it fail?

jimuIee avatar Dec 12 '22 09:12 jimuIee