Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to get FLOPs of two stage algorithm in MMDetection 3.x? #589

Closed
vansin opened this issue Oct 6, 2022 · 3 comments
Closed

how to get FLOPs of two stage algorithm in MMDetection 3.x? #589

vansin opened this issue Oct 6, 2022 · 3 comments
Assignees

Comments

@vansin
Copy link
Collaborator

vansin commented Oct 6, 2022

What is the problem this feature will solve?

I can get one stage algorithm but get two stage algorithm failed

failed~

(mmyd) ➜  mmdetection git:(3.x) python tools/analysis_tools/get_flops.py configs/faster_rcnn/faster-rcnn_r101_fpn_1x_coco.py 
Traceback (most recent call last):
  File "tools/analysis_tools/get_flops.py", line 88, in <module>
    main()
  File "tools/analysis_tools/get_flops.py", line 73, in main
    flops, params = get_model_complexity_info(model, input_shape)
  File "/project/mmlab2/mmcv/mmcv/cnn/utils/flops_counter.py", line 106, in get_model_complexity_info
    _ = flops_model(batch)
  File "/home/elaine/miniconda3/envs/mmyd/lib/python3.8/site-packages/torch/nn/modules/module.py", line 1120, in _call_impl
    result = forward_call(*input, **kwargs)
  File "/project/mmlab2/mmdetection/mmdet/models/detectors/base.py", line 96, in forward
    return self._forward(inputs, data_samples)
  File "/project/mmlab2/mmdetection/mmdet/models/detectors/two_stage.py", line 131, in _forward
    rpn_results_list = self.rpn_head.predict(
  File "/project/mmlab2/mmdetection/mmdet/models/dense_heads/base_dense_head.py", line 190, in predict
    batch_img_metas = [
TypeError: 'NoneType' object is not iterable

yolov3 success

(mmyd) ➜  mmdetection git:(3.x) python tools/analysis_tools/get_flops.py configs/yolo/yolov3_d53_8xb8-320-273e_coco.py 
YOLOV3(
  61.949 M, 100.000% Params, 195.549 GFLOPs, 100.000% FLOPs, 
  (data_preprocessor): DetDataPreprocessor(0.0 M, 0.000% Params, 0.0 GFLOPs, 0.000% FLOPs, )
  (backbone): Darknet(
    40.585 M, 65.513% Params, 145.645 GFLOPs, 74.480% FLOPs, 
    (conv1): ConvModule(
      0.001 M, 0.001% Params, 0.983 GFLOPs, 0.503% FLOPs, 
      (conv): Conv2d(0.001 M, 0.001% Params, 0.885 GFLOPs, 0.452% FLOPs, 3, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
      (bn): BatchNorm2d(0.0 M, 0.000% Params, 0.066 GFLOPs, 0.034% FLOPs, 32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (activate): LeakyReLU(0.0 M, 0.000% Params, 0.033 GFLOPs, 0.017% FLOPs, negative_slope=0.1, inplace=True)
    )
    (conv_res_block1): Sequential(
      0.039 M, 0.063% Params, 10.084 GFLOPs, 5.157% FLOPs, 
      (conv): ConvModule(
        0.019 M, 0.030% Params, 4.768 GFLOPs, 2.438% FLOPs, 
        (conv): Conv2d(0.018 M, 0.030% Params, 4.719 GFLOPs, 2.413% FLOPs, 32, 64, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)
        (bn): BatchNorm2d(0.0 M, 0.000% Params, 0.033 GFLOPs, 0.017% FLOPs, 64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (activate): LeakyReLU(0.0 M, 0.000% Params, 0.016 GFLOPs, 0.008% FLOPs, negative_slope=0.1, inplace=True)
      )
      (res0): ResBlock(
        0.021 M, 0.033% Params, 5.317 GFLOPs, 2.719% FLOPs, 
        (conv1): ConvModule(
          0.002 M, 0.003% Params, 0.549 GFLOPs, 0.281% FLOPs, 
          (conv): Conv2d(0.002 M, 0.003% Params, 0.524 GFLOPs, 0.268% FLOPs, 64, 32, kernel_size=(1, 1), stride=(1, 1), bias=False)
          (bn): BatchNorm2d(0.0 M, 0.000% Params, 0.016 GFLOPs, 0.008% FLOPs, 32, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.008 GFLOPs, 0.004% FLOPs, negative_slope=0.1, inplace=True)
        )
        (conv2): ConvModule(
          0.019 M, 0.030% Params, 4.768 GFLOPs, 2.438% FLOPs, 
          (conv): Conv2d(0.018 M, 0.030% Params, 4.719 GFLOPs, 2.413% FLOPs, 32, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
          (bn): BatchNorm2d(0.0 M, 0.000% Params, 0.033 GFLOPs, 0.017% FLOPs, 64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.016 GFLOPs, 0.008% FLOPs, negative_slope=0.1, inplace=True)
        )
      )
    )
    (conv_res_block2): Sequential(
      0.239 M, 0.385% Params, 15.303 GFLOPs, 7.825% FLOPs, 
      (conv): ConvModule(
        0.074 M, 0.119% Params, 4.743 GFLOPs, 2.426% FLOPs, 
        (conv): Conv2d(0.074 M, 0.119% Params, 4.719 GFLOPs, 2.413% FLOPs, 64, 128, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)
        (bn): BatchNorm2d(0.0 M, 0.000% Params, 0.016 GFLOPs, 0.008% FLOPs, 128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (activate): LeakyReLU(0.0 M, 0.000% Params, 0.008 GFLOPs, 0.004% FLOPs, negative_slope=0.1, inplace=True)
      )
      (res0): ResBlock(
        0.082 M, 0.133% Params, 5.28 GFLOPs, 2.700% FLOPs, 
        (conv1): ConvModule(
          0.008 M, 0.013% Params, 0.537 GFLOPs, 0.274% FLOPs, 
          (conv): Conv2d(0.008 M, 0.013% Params, 0.524 GFLOPs, 0.268% FLOPs, 128, 64, kernel_size=(1, 1), stride=(1, 1), bias=False)
          (bn): BatchNorm2d(0.0 M, 0.000% Params, 0.008 GFLOPs, 0.004% FLOPs, 64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.004 GFLOPs, 0.002% FLOPs, negative_slope=0.1, inplace=True)
        )
        (conv2): ConvModule(
          0.074 M, 0.119% Params, 4.743 GFLOPs, 2.426% FLOPs, 
          (conv): Conv2d(0.074 M, 0.119% Params, 4.719 GFLOPs, 2.413% FLOPs, 64, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
          (bn): BatchNorm2d(0.0 M, 0.000% Params, 0.016 GFLOPs, 0.008% FLOPs, 128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.008 GFLOPs, 0.004% FLOPs, negative_slope=0.1, inplace=True)
        )
      )
      (res1): ResBlock(
        0.082 M, 0.133% Params, 5.28 GFLOPs, 2.700% FLOPs, 
        (conv1): ConvModule(
          0.008 M, 0.013% Params, 0.537 GFLOPs, 0.274% FLOPs, 
          (conv): Conv2d(0.008 M, 0.013% Params, 0.524 GFLOPs, 0.268% FLOPs, 128, 64, kernel_size=(1, 1), stride=(1, 1), bias=False)
          (bn): BatchNorm2d(0.0 M, 0.000% Params, 0.008 GFLOPs, 0.004% FLOPs, 64, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.004 GFLOPs, 0.002% FLOPs, negative_slope=0.1, inplace=True)
        )
        (conv2): ConvModule(
          0.074 M, 0.119% Params, 4.743 GFLOPs, 2.426% FLOPs, 
          (conv): Conv2d(0.074 M, 0.119% Params, 4.719 GFLOPs, 2.413% FLOPs, 64, 128, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
          (bn): BatchNorm2d(0.0 M, 0.000% Params, 0.016 GFLOPs, 0.008% FLOPs, 128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.008 GFLOPs, 0.004% FLOPs, negative_slope=0.1, inplace=True)
        )
      )
    )
    (conv_res_block3): Sequential(
      2.923 M, 4.718% Params, 46.821 GFLOPs, 23.944% FLOPs, 
      (conv): ConvModule(
        0.295 M, 0.477% Params, 4.731 GFLOPs, 2.419% FLOPs, 
        (conv): Conv2d(0.295 M, 0.476% Params, 4.719 GFLOPs, 2.413% FLOPs, 128, 256, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)
        (bn): BatchNorm2d(0.001 M, 0.001% Params, 0.008 GFLOPs, 0.004% FLOPs, 256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (activate): LeakyReLU(0.0 M, 0.000% Params, 0.004 GFLOPs, 0.002% FLOPs, negative_slope=0.1, inplace=True)
      )
      (res0): ResBlock(
        0.328 M, 0.530% Params, 5.261 GFLOPs, 2.691% FLOPs, 
        (conv1): ConvModule(
          0.033 M, 0.053% Params, 0.53 GFLOPs, 0.271% FLOPs, 
          (conv): Conv2d(0.033 M, 0.053% Params, 0.524 GFLOPs, 0.268% FLOPs, 256, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)
          (bn): BatchNorm2d(0.0 M, 0.000% Params, 0.004 GFLOPs, 0.002% FLOPs, 128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.002 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
        )
        (conv2): ConvModule(
          0.295 M, 0.477% Params, 4.731 GFLOPs, 2.419% FLOPs, 
          (conv): Conv2d(0.295 M, 0.476% Params, 4.719 GFLOPs, 2.413% FLOPs, 128, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
          (bn): BatchNorm2d(0.001 M, 0.001% Params, 0.008 GFLOPs, 0.004% FLOPs, 256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.004 GFLOPs, 0.002% FLOPs, negative_slope=0.1, inplace=True)
        )
      )
      (res1): ResBlock(
        0.328 M, 0.530% Params, 5.261 GFLOPs, 2.691% FLOPs, 
        (conv1): ConvModule(
          0.033 M, 0.053% Params, 0.53 GFLOPs, 0.271% FLOPs, 
          (conv): Conv2d(0.033 M, 0.053% Params, 0.524 GFLOPs, 0.268% FLOPs, 256, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)
          (bn): BatchNorm2d(0.0 M, 0.000% Params, 0.004 GFLOPs, 0.002% FLOPs, 128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.002 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
        )
        (conv2): ConvModule(
          0.295 M, 0.477% Params, 4.731 GFLOPs, 2.419% FLOPs, 
          (conv): Conv2d(0.295 M, 0.476% Params, 4.719 GFLOPs, 2.413% FLOPs, 128, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
          (bn): BatchNorm2d(0.001 M, 0.001% Params, 0.008 GFLOPs, 0.004% FLOPs, 256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.004 GFLOPs, 0.002% FLOPs, negative_slope=0.1, inplace=True)
        )
      )
      (res2): ResBlock(
        0.328 M, 0.530% Params, 5.261 GFLOPs, 2.691% FLOPs, 
        (conv1): ConvModule(
          0.033 M, 0.053% Params, 0.53 GFLOPs, 0.271% FLOPs, 
          (conv): Conv2d(0.033 M, 0.053% Params, 0.524 GFLOPs, 0.268% FLOPs, 256, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)
          (bn): BatchNorm2d(0.0 M, 0.000% Params, 0.004 GFLOPs, 0.002% FLOPs, 128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.002 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
        )
        (conv2): ConvModule(
          0.295 M, 0.477% Params, 4.731 GFLOPs, 2.419% FLOPs, 
          (conv): Conv2d(0.295 M, 0.476% Params, 4.719 GFLOPs, 2.413% FLOPs, 128, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
          (bn): BatchNorm2d(0.001 M, 0.001% Params, 0.008 GFLOPs, 0.004% FLOPs, 256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.004 GFLOPs, 0.002% FLOPs, negative_slope=0.1, inplace=True)
        )
      )
      (res3): ResBlock(
        0.328 M, 0.530% Params, 5.261 GFLOPs, 2.691% FLOPs, 
        (conv1): ConvModule(
          0.033 M, 0.053% Params, 0.53 GFLOPs, 0.271% FLOPs, 
          (conv): Conv2d(0.033 M, 0.053% Params, 0.524 GFLOPs, 0.268% FLOPs, 256, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)
          (bn): BatchNorm2d(0.0 M, 0.000% Params, 0.004 GFLOPs, 0.002% FLOPs, 128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.002 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
        )
        (conv2): ConvModule(
          0.295 M, 0.477% Params, 4.731 GFLOPs, 2.419% FLOPs, 
          (conv): Conv2d(0.295 M, 0.476% Params, 4.719 GFLOPs, 2.413% FLOPs, 128, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
          (bn): BatchNorm2d(0.001 M, 0.001% Params, 0.008 GFLOPs, 0.004% FLOPs, 256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.004 GFLOPs, 0.002% FLOPs, negative_slope=0.1, inplace=True)
        )
      )
      (res4): ResBlock(
        0.328 M, 0.530% Params, 5.261 GFLOPs, 2.691% FLOPs, 
        (conv1): ConvModule(
          0.033 M, 0.053% Params, 0.53 GFLOPs, 0.271% FLOPs, 
          (conv): Conv2d(0.033 M, 0.053% Params, 0.524 GFLOPs, 0.268% FLOPs, 256, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)
          (bn): BatchNorm2d(0.0 M, 0.000% Params, 0.004 GFLOPs, 0.002% FLOPs, 128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.002 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
        )
        (conv2): ConvModule(
          0.295 M, 0.477% Params, 4.731 GFLOPs, 2.419% FLOPs, 
          (conv): Conv2d(0.295 M, 0.476% Params, 4.719 GFLOPs, 2.413% FLOPs, 128, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
          (bn): BatchNorm2d(0.001 M, 0.001% Params, 0.008 GFLOPs, 0.004% FLOPs, 256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.004 GFLOPs, 0.002% FLOPs, negative_slope=0.1, inplace=True)
        )
      )
      (res5): ResBlock(
        0.328 M, 0.530% Params, 5.261 GFLOPs, 2.691% FLOPs, 
        (conv1): ConvModule(
          0.033 M, 0.053% Params, 0.53 GFLOPs, 0.271% FLOPs, 
          (conv): Conv2d(0.033 M, 0.053% Params, 0.524 GFLOPs, 0.268% FLOPs, 256, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)
          (bn): BatchNorm2d(0.0 M, 0.000% Params, 0.004 GFLOPs, 0.002% FLOPs, 128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.002 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
        )
        (conv2): ConvModule(
          0.295 M, 0.477% Params, 4.731 GFLOPs, 2.419% FLOPs, 
          (conv): Conv2d(0.295 M, 0.476% Params, 4.719 GFLOPs, 2.413% FLOPs, 128, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
          (bn): BatchNorm2d(0.001 M, 0.001% Params, 0.008 GFLOPs, 0.004% FLOPs, 256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.004 GFLOPs, 0.002% FLOPs, negative_slope=0.1, inplace=True)
        )
      )
      (res6): ResBlock(
        0.328 M, 0.530% Params, 5.261 GFLOPs, 2.691% FLOPs, 
        (conv1): ConvModule(
          0.033 M, 0.053% Params, 0.53 GFLOPs, 0.271% FLOPs, 
          (conv): Conv2d(0.033 M, 0.053% Params, 0.524 GFLOPs, 0.268% FLOPs, 256, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)
          (bn): BatchNorm2d(0.0 M, 0.000% Params, 0.004 GFLOPs, 0.002% FLOPs, 128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.002 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
        )
        (conv2): ConvModule(
          0.295 M, 0.477% Params, 4.731 GFLOPs, 2.419% FLOPs, 
          (conv): Conv2d(0.295 M, 0.476% Params, 4.719 GFLOPs, 2.413% FLOPs, 128, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
          (bn): BatchNorm2d(0.001 M, 0.001% Params, 0.008 GFLOPs, 0.004% FLOPs, 256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.004 GFLOPs, 0.002% FLOPs, negative_slope=0.1, inplace=True)
        )
      )
      (res7): ResBlock(
        0.328 M, 0.530% Params, 5.261 GFLOPs, 2.691% FLOPs, 
        (conv1): ConvModule(
          0.033 M, 0.053% Params, 0.53 GFLOPs, 0.271% FLOPs, 
          (conv): Conv2d(0.033 M, 0.053% Params, 0.524 GFLOPs, 0.268% FLOPs, 256, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)
          (bn): BatchNorm2d(0.0 M, 0.000% Params, 0.004 GFLOPs, 0.002% FLOPs, 128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.002 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
        )
        (conv2): ConvModule(
          0.295 M, 0.477% Params, 4.731 GFLOPs, 2.419% FLOPs, 
          (conv): Conv2d(0.295 M, 0.476% Params, 4.719 GFLOPs, 2.413% FLOPs, 128, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
          (bn): BatchNorm2d(0.001 M, 0.001% Params, 0.008 GFLOPs, 0.004% FLOPs, 256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.004 GFLOPs, 0.002% FLOPs, negative_slope=0.1, inplace=True)
        )
      )
    )
    (conv_res_block4): Sequential(
      11.679 M, 18.852% Params, 46.742 GFLOPs, 23.903% FLOPs, 
      (conv): ConvModule(
        1.181 M, 1.906% Params, 4.725 GFLOPs, 2.416% FLOPs, 
        (conv): Conv2d(1.18 M, 1.904% Params, 4.719 GFLOPs, 2.413% FLOPs, 256, 512, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)
        (bn): BatchNorm2d(0.001 M, 0.002% Params, 0.004 GFLOPs, 0.002% FLOPs, 512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (activate): LeakyReLU(0.0 M, 0.000% Params, 0.002 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
      )
      (res0): ResBlock(
        1.312 M, 2.118% Params, 5.252 GFLOPs, 2.686% FLOPs, 
        (conv1): ConvModule(
          0.132 M, 0.212% Params, 0.527 GFLOPs, 0.270% FLOPs, 
          (conv): Conv2d(0.131 M, 0.212% Params, 0.524 GFLOPs, 0.268% FLOPs, 512, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
          (bn): BatchNorm2d(0.001 M, 0.001% Params, 0.002 GFLOPs, 0.001% FLOPs, 256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.001 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
        )
        (conv2): ConvModule(
          1.181 M, 1.906% Params, 4.725 GFLOPs, 2.416% FLOPs, 
          (conv): Conv2d(1.18 M, 1.904% Params, 4.719 GFLOPs, 2.413% FLOPs, 256, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
          (bn): BatchNorm2d(0.001 M, 0.002% Params, 0.004 GFLOPs, 0.002% FLOPs, 512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.002 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
        )
      )
      (res1): ResBlock(
        1.312 M, 2.118% Params, 5.252 GFLOPs, 2.686% FLOPs, 
        (conv1): ConvModule(
          0.132 M, 0.212% Params, 0.527 GFLOPs, 0.270% FLOPs, 
          (conv): Conv2d(0.131 M, 0.212% Params, 0.524 GFLOPs, 0.268% FLOPs, 512, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
          (bn): BatchNorm2d(0.001 M, 0.001% Params, 0.002 GFLOPs, 0.001% FLOPs, 256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.001 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
        )
        (conv2): ConvModule(
          1.181 M, 1.906% Params, 4.725 GFLOPs, 2.416% FLOPs, 
          (conv): Conv2d(1.18 M, 1.904% Params, 4.719 GFLOPs, 2.413% FLOPs, 256, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
          (bn): BatchNorm2d(0.001 M, 0.002% Params, 0.004 GFLOPs, 0.002% FLOPs, 512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.002 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
        )
      )
      (res2): ResBlock(
        1.312 M, 2.118% Params, 5.252 GFLOPs, 2.686% FLOPs, 
        (conv1): ConvModule(
          0.132 M, 0.212% Params, 0.527 GFLOPs, 0.270% FLOPs, 
          (conv): Conv2d(0.131 M, 0.212% Params, 0.524 GFLOPs, 0.268% FLOPs, 512, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
          (bn): BatchNorm2d(0.001 M, 0.001% Params, 0.002 GFLOPs, 0.001% FLOPs, 256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.001 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
        )
        (conv2): ConvModule(
          1.181 M, 1.906% Params, 4.725 GFLOPs, 2.416% FLOPs, 
          (conv): Conv2d(1.18 M, 1.904% Params, 4.719 GFLOPs, 2.413% FLOPs, 256, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
          (bn): BatchNorm2d(0.001 M, 0.002% Params, 0.004 GFLOPs, 0.002% FLOPs, 512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.002 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
        )
      )
      (res3): ResBlock(
        1.312 M, 2.118% Params, 5.252 GFLOPs, 2.686% FLOPs, 
        (conv1): ConvModule(
          0.132 M, 0.212% Params, 0.527 GFLOPs, 0.270% FLOPs, 
          (conv): Conv2d(0.131 M, 0.212% Params, 0.524 GFLOPs, 0.268% FLOPs, 512, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
          (bn): BatchNorm2d(0.001 M, 0.001% Params, 0.002 GFLOPs, 0.001% FLOPs, 256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.001 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
        )
        (conv2): ConvModule(
          1.181 M, 1.906% Params, 4.725 GFLOPs, 2.416% FLOPs, 
          (conv): Conv2d(1.18 M, 1.904% Params, 4.719 GFLOPs, 2.413% FLOPs, 256, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
          (bn): BatchNorm2d(0.001 M, 0.002% Params, 0.004 GFLOPs, 0.002% FLOPs, 512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.002 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
        )
      )
      (res4): ResBlock(
        1.312 M, 2.118% Params, 5.252 GFLOPs, 2.686% FLOPs, 
        (conv1): ConvModule(
          0.132 M, 0.212% Params, 0.527 GFLOPs, 0.270% FLOPs, 
          (conv): Conv2d(0.131 M, 0.212% Params, 0.524 GFLOPs, 0.268% FLOPs, 512, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
          (bn): BatchNorm2d(0.001 M, 0.001% Params, 0.002 GFLOPs, 0.001% FLOPs, 256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.001 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
        )
        (conv2): ConvModule(
          1.181 M, 1.906% Params, 4.725 GFLOPs, 2.416% FLOPs, 
          (conv): Conv2d(1.18 M, 1.904% Params, 4.719 GFLOPs, 2.413% FLOPs, 256, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
          (bn): BatchNorm2d(0.001 M, 0.002% Params, 0.004 GFLOPs, 0.002% FLOPs, 512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.002 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
        )
      )
      (res5): ResBlock(
        1.312 M, 2.118% Params, 5.252 GFLOPs, 2.686% FLOPs, 
        (conv1): ConvModule(
          0.132 M, 0.212% Params, 0.527 GFLOPs, 0.270% FLOPs, 
          (conv): Conv2d(0.131 M, 0.212% Params, 0.524 GFLOPs, 0.268% FLOPs, 512, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
          (bn): BatchNorm2d(0.001 M, 0.001% Params, 0.002 GFLOPs, 0.001% FLOPs, 256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.001 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
        )
        (conv2): ConvModule(
          1.181 M, 1.906% Params, 4.725 GFLOPs, 2.416% FLOPs, 
          (conv): Conv2d(1.18 M, 1.904% Params, 4.719 GFLOPs, 2.413% FLOPs, 256, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
          (bn): BatchNorm2d(0.001 M, 0.002% Params, 0.004 GFLOPs, 0.002% FLOPs, 512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.002 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
        )
      )
      (res6): ResBlock(
        1.312 M, 2.118% Params, 5.252 GFLOPs, 2.686% FLOPs, 
        (conv1): ConvModule(
          0.132 M, 0.212% Params, 0.527 GFLOPs, 0.270% FLOPs, 
          (conv): Conv2d(0.131 M, 0.212% Params, 0.524 GFLOPs, 0.268% FLOPs, 512, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
          (bn): BatchNorm2d(0.001 M, 0.001% Params, 0.002 GFLOPs, 0.001% FLOPs, 256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.001 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
        )
        (conv2): ConvModule(
          1.181 M, 1.906% Params, 4.725 GFLOPs, 2.416% FLOPs, 
          (conv): Conv2d(1.18 M, 1.904% Params, 4.719 GFLOPs, 2.413% FLOPs, 256, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
          (bn): BatchNorm2d(0.001 M, 0.002% Params, 0.004 GFLOPs, 0.002% FLOPs, 512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.002 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
        )
      )
      (res7): ResBlock(
        1.312 M, 2.118% Params, 5.252 GFLOPs, 2.686% FLOPs, 
        (conv1): ConvModule(
          0.132 M, 0.212% Params, 0.527 GFLOPs, 0.270% FLOPs, 
          (conv): Conv2d(0.131 M, 0.212% Params, 0.524 GFLOPs, 0.268% FLOPs, 512, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
          (bn): BatchNorm2d(0.001 M, 0.001% Params, 0.002 GFLOPs, 0.001% FLOPs, 256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.001 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
        )
        (conv2): ConvModule(
          1.181 M, 1.906% Params, 4.725 GFLOPs, 2.416% FLOPs, 
          (conv): Conv2d(1.18 M, 1.904% Params, 4.719 GFLOPs, 2.413% FLOPs, 256, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
          (bn): BatchNorm2d(0.001 M, 0.002% Params, 0.004 GFLOPs, 0.002% FLOPs, 512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.002 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
        )
      )
    )
    (conv_res_block5): Sequential(
      25.704 M, 41.493% Params, 25.712 GFLOPs, 13.148% FLOPs, 
      (conv): ConvModule(
        4.721 M, 7.620% Params, 4.722 GFLOPs, 2.415% FLOPs, 
        (conv): Conv2d(4.719 M, 7.617% Params, 4.719 GFLOPs, 2.413% FLOPs, 512, 1024, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)
        (bn): BatchNorm2d(0.002 M, 0.003% Params, 0.002 GFLOPs, 0.001% FLOPs, 1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (activate): LeakyReLU(0.0 M, 0.000% Params, 0.001 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
      )
      (res0): ResBlock(
        5.246 M, 8.468% Params, 5.247 GFLOPs, 2.683% FLOPs, 
        (conv1): ConvModule(
          0.525 M, 0.848% Params, 0.526 GFLOPs, 0.269% FLOPs, 
          (conv): Conv2d(0.524 M, 0.846% Params, 0.524 GFLOPs, 0.268% FLOPs, 1024, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
          (bn): BatchNorm2d(0.001 M, 0.002% Params, 0.001 GFLOPs, 0.001% FLOPs, 512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.001 GFLOPs, 0.000% FLOPs, negative_slope=0.1, inplace=True)
        )
        (conv2): ConvModule(
          4.721 M, 7.620% Params, 4.722 GFLOPs, 2.415% FLOPs, 
          (conv): Conv2d(4.719 M, 7.617% Params, 4.719 GFLOPs, 2.413% FLOPs, 512, 1024, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
          (bn): BatchNorm2d(0.002 M, 0.003% Params, 0.002 GFLOPs, 0.001% FLOPs, 1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.001 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
        )
      )
      (res1): ResBlock(
        5.246 M, 8.468% Params, 5.247 GFLOPs, 2.683% FLOPs, 
        (conv1): ConvModule(
          0.525 M, 0.848% Params, 0.526 GFLOPs, 0.269% FLOPs, 
          (conv): Conv2d(0.524 M, 0.846% Params, 0.524 GFLOPs, 0.268% FLOPs, 1024, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
          (bn): BatchNorm2d(0.001 M, 0.002% Params, 0.001 GFLOPs, 0.001% FLOPs, 512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.001 GFLOPs, 0.000% FLOPs, negative_slope=0.1, inplace=True)
        )
        (conv2): ConvModule(
          4.721 M, 7.620% Params, 4.722 GFLOPs, 2.415% FLOPs, 
          (conv): Conv2d(4.719 M, 7.617% Params, 4.719 GFLOPs, 2.413% FLOPs, 512, 1024, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
          (bn): BatchNorm2d(0.002 M, 0.003% Params, 0.002 GFLOPs, 0.001% FLOPs, 1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.001 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
        )
      )
      (res2): ResBlock(
        5.246 M, 8.468% Params, 5.247 GFLOPs, 2.683% FLOPs, 
        (conv1): ConvModule(
          0.525 M, 0.848% Params, 0.526 GFLOPs, 0.269% FLOPs, 
          (conv): Conv2d(0.524 M, 0.846% Params, 0.524 GFLOPs, 0.268% FLOPs, 1024, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
          (bn): BatchNorm2d(0.001 M, 0.002% Params, 0.001 GFLOPs, 0.001% FLOPs, 512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.001 GFLOPs, 0.000% FLOPs, negative_slope=0.1, inplace=True)
        )
        (conv2): ConvModule(
          4.721 M, 7.620% Params, 4.722 GFLOPs, 2.415% FLOPs, 
          (conv): Conv2d(4.719 M, 7.617% Params, 4.719 GFLOPs, 2.413% FLOPs, 512, 1024, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
          (bn): BatchNorm2d(0.002 M, 0.003% Params, 0.002 GFLOPs, 0.001% FLOPs, 1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.001 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
        )
      )
      (res3): ResBlock(
        5.246 M, 8.468% Params, 5.247 GFLOPs, 2.683% FLOPs, 
        (conv1): ConvModule(
          0.525 M, 0.848% Params, 0.526 GFLOPs, 0.269% FLOPs, 
          (conv): Conv2d(0.524 M, 0.846% Params, 0.524 GFLOPs, 0.268% FLOPs, 1024, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
          (bn): BatchNorm2d(0.001 M, 0.002% Params, 0.001 GFLOPs, 0.001% FLOPs, 512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.001 GFLOPs, 0.000% FLOPs, negative_slope=0.1, inplace=True)
        )
        (conv2): ConvModule(
          4.721 M, 7.620% Params, 4.722 GFLOPs, 2.415% FLOPs, 
          (conv): Conv2d(4.719 M, 7.617% Params, 4.719 GFLOPs, 2.413% FLOPs, 512, 1024, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
          (bn): BatchNorm2d(0.002 M, 0.003% Params, 0.002 GFLOPs, 0.001% FLOPs, 1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
          (activate): LeakyReLU(0.0 M, 0.000% Params, 0.001 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
        )
      )
    )
  )
  init_cfg={'type': 'Pretrained', 'checkpoint': 'open-mmlab://darknet53'}
  (neck): YOLOV3Neck(
    14.71 M, 23.745% Params, 33.894 GFLOPs, 17.333% FLOPs, 
    (detect1): DetectionBlock(
      11.017 M, 17.784% Params, 11.021 GFLOPs, 5.636% FLOPs, 
      (conv1): ConvModule(
        0.525 M, 0.848% Params, 0.526 GFLOPs, 0.269% FLOPs, 
        (conv): Conv2d(0.524 M, 0.846% Params, 0.524 GFLOPs, 0.268% FLOPs, 1024, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn): BatchNorm2d(0.001 M, 0.002% Params, 0.001 GFLOPs, 0.001% FLOPs, 512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (activate): LeakyReLU(0.0 M, 0.000% Params, 0.001 GFLOPs, 0.000% FLOPs, negative_slope=0.1, inplace=True)
      )
      (conv2): ConvModule(
        4.721 M, 7.620% Params, 4.722 GFLOPs, 2.415% FLOPs, 
        (conv): Conv2d(4.719 M, 7.617% Params, 4.719 GFLOPs, 2.413% FLOPs, 512, 1024, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
        (bn): BatchNorm2d(0.002 M, 0.003% Params, 0.002 GFLOPs, 0.001% FLOPs, 1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (activate): LeakyReLU(0.0 M, 0.000% Params, 0.001 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
      )
      (conv3): ConvModule(
        0.525 M, 0.848% Params, 0.526 GFLOPs, 0.269% FLOPs, 
        (conv): Conv2d(0.524 M, 0.846% Params, 0.524 GFLOPs, 0.268% FLOPs, 1024, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn): BatchNorm2d(0.001 M, 0.002% Params, 0.001 GFLOPs, 0.001% FLOPs, 512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (activate): LeakyReLU(0.0 M, 0.000% Params, 0.001 GFLOPs, 0.000% FLOPs, negative_slope=0.1, inplace=True)
      )
      (conv4): ConvModule(
        4.721 M, 7.620% Params, 4.722 GFLOPs, 2.415% FLOPs, 
        (conv): Conv2d(4.719 M, 7.617% Params, 4.719 GFLOPs, 2.413% FLOPs, 512, 1024, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
        (bn): BatchNorm2d(0.002 M, 0.003% Params, 0.002 GFLOPs, 0.001% FLOPs, 1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (activate): LeakyReLU(0.0 M, 0.000% Params, 0.001 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
      )
      (conv5): ConvModule(
        0.525 M, 0.848% Params, 0.526 GFLOPs, 0.269% FLOPs, 
        (conv): Conv2d(0.524 M, 0.846% Params, 0.524 GFLOPs, 0.268% FLOPs, 1024, 512, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn): BatchNorm2d(0.001 M, 0.002% Params, 0.001 GFLOPs, 0.001% FLOPs, 512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (activate): LeakyReLU(0.0 M, 0.000% Params, 0.001 GFLOPs, 0.000% FLOPs, negative_slope=0.1, inplace=True)
      )
    )
    (conv1): ConvModule(
      0.132 M, 0.212% Params, 0.132 GFLOPs, 0.067% FLOPs, 
      (conv): Conv2d(0.131 M, 0.212% Params, 0.131 GFLOPs, 0.067% FLOPs, 512, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
      (bn): BatchNorm2d(0.001 M, 0.001% Params, 0.001 GFLOPs, 0.000% FLOPs, 256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (activate): LeakyReLU(0.0 M, 0.000% Params, 0.0 GFLOPs, 0.000% FLOPs, negative_slope=0.1, inplace=True)
    )
    (detect2): DetectionBlock(
      2.822 M, 4.555% Params, 11.294 GFLOPs, 5.775% FLOPs, 
      (conv1): ConvModule(
        0.197 M, 0.318% Params, 0.79 GFLOPs, 0.404% FLOPs, 
        (conv): Conv2d(0.197 M, 0.317% Params, 0.786 GFLOPs, 0.402% FLOPs, 768, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn): BatchNorm2d(0.001 M, 0.001% Params, 0.002 GFLOPs, 0.001% FLOPs, 256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (activate): LeakyReLU(0.0 M, 0.000% Params, 0.001 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
      )
      (conv2): ConvModule(
        1.181 M, 1.906% Params, 4.725 GFLOPs, 2.416% FLOPs, 
        (conv): Conv2d(1.18 M, 1.904% Params, 4.719 GFLOPs, 2.413% FLOPs, 256, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
        (bn): BatchNorm2d(0.001 M, 0.002% Params, 0.004 GFLOPs, 0.002% FLOPs, 512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (activate): LeakyReLU(0.0 M, 0.000% Params, 0.002 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
      )
      (conv3): ConvModule(
        0.132 M, 0.212% Params, 0.527 GFLOPs, 0.270% FLOPs, 
        (conv): Conv2d(0.131 M, 0.212% Params, 0.524 GFLOPs, 0.268% FLOPs, 512, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn): BatchNorm2d(0.001 M, 0.001% Params, 0.002 GFLOPs, 0.001% FLOPs, 256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (activate): LeakyReLU(0.0 M, 0.000% Params, 0.001 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
      )
      (conv4): ConvModule(
        1.181 M, 1.906% Params, 4.725 GFLOPs, 2.416% FLOPs, 
        (conv): Conv2d(1.18 M, 1.904% Params, 4.719 GFLOPs, 2.413% FLOPs, 256, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
        (bn): BatchNorm2d(0.001 M, 0.002% Params, 0.004 GFLOPs, 0.002% FLOPs, 512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (activate): LeakyReLU(0.0 M, 0.000% Params, 0.002 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
      )
      (conv5): ConvModule(
        0.132 M, 0.212% Params, 0.527 GFLOPs, 0.270% FLOPs, 
        (conv): Conv2d(0.131 M, 0.212% Params, 0.524 GFLOPs, 0.268% FLOPs, 512, 256, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn): BatchNorm2d(0.001 M, 0.001% Params, 0.002 GFLOPs, 0.001% FLOPs, 256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (activate): LeakyReLU(0.0 M, 0.000% Params, 0.001 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
      )
    )
    (conv2): ConvModule(
      0.033 M, 0.053% Params, 0.133 GFLOPs, 0.068% FLOPs, 
      (conv): Conv2d(0.033 M, 0.053% Params, 0.131 GFLOPs, 0.067% FLOPs, 256, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)
      (bn): BatchNorm2d(0.0 M, 0.000% Params, 0.001 GFLOPs, 0.001% FLOPs, 128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
      (activate): LeakyReLU(0.0 M, 0.000% Params, 0.001 GFLOPs, 0.000% FLOPs, negative_slope=0.1, inplace=True)
    )
    (detect3): DetectionBlock(
      0.706 M, 1.140% Params, 11.315 GFLOPs, 5.786% FLOPs, 
      (conv1): ConvModule(
        0.049 M, 0.080% Params, 0.793 GFLOPs, 0.405% FLOPs, 
        (conv): Conv2d(0.049 M, 0.079% Params, 0.786 GFLOPs, 0.402% FLOPs, 384, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn): BatchNorm2d(0.0 M, 0.000% Params, 0.004 GFLOPs, 0.002% FLOPs, 128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (activate): LeakyReLU(0.0 M, 0.000% Params, 0.002 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
      )
      (conv2): ConvModule(
        0.295 M, 0.477% Params, 4.731 GFLOPs, 2.419% FLOPs, 
        (conv): Conv2d(0.295 M, 0.476% Params, 4.719 GFLOPs, 2.413% FLOPs, 128, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
        (bn): BatchNorm2d(0.001 M, 0.001% Params, 0.008 GFLOPs, 0.004% FLOPs, 256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (activate): LeakyReLU(0.0 M, 0.000% Params, 0.004 GFLOPs, 0.002% FLOPs, negative_slope=0.1, inplace=True)
      )
      (conv3): ConvModule(
        0.033 M, 0.053% Params, 0.53 GFLOPs, 0.271% FLOPs, 
        (conv): Conv2d(0.033 M, 0.053% Params, 0.524 GFLOPs, 0.268% FLOPs, 256, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn): BatchNorm2d(0.0 M, 0.000% Params, 0.004 GFLOPs, 0.002% FLOPs, 128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (activate): LeakyReLU(0.0 M, 0.000% Params, 0.002 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
      )
      (conv4): ConvModule(
        0.295 M, 0.477% Params, 4.731 GFLOPs, 2.419% FLOPs, 
        (conv): Conv2d(0.295 M, 0.476% Params, 4.719 GFLOPs, 2.413% FLOPs, 128, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
        (bn): BatchNorm2d(0.001 M, 0.001% Params, 0.008 GFLOPs, 0.004% FLOPs, 256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (activate): LeakyReLU(0.0 M, 0.000% Params, 0.004 GFLOPs, 0.002% FLOPs, negative_slope=0.1, inplace=True)
      )
      (conv5): ConvModule(
        0.033 M, 0.053% Params, 0.53 GFLOPs, 0.271% FLOPs, 
        (conv): Conv2d(0.033 M, 0.053% Params, 0.524 GFLOPs, 0.268% FLOPs, 256, 128, kernel_size=(1, 1), stride=(1, 1), bias=False)
        (bn): BatchNorm2d(0.0 M, 0.000% Params, 0.004 GFLOPs, 0.002% FLOPs, 128, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (activate): LeakyReLU(0.0 M, 0.000% Params, 0.002 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
      )
    )
  )
  (bbox_head): YOLOV3Head(
    6.654 M, 10.742% Params, 16.01 GFLOPs, 8.187% FLOPs, 
    (loss_cls): CrossEntropyLoss(0.0 M, 0.000% Params, 0.0 GFLOPs, 0.000% FLOPs, avg_non_ignore=False)
    (loss_conf): CrossEntropyLoss(0.0 M, 0.000% Params, 0.0 GFLOPs, 0.000% FLOPs, avg_non_ignore=False)
    (loss_xy): CrossEntropyLoss(0.0 M, 0.000% Params, 0.0 GFLOPs, 0.000% FLOPs, avg_non_ignore=False)
    (loss_wh): MSELoss(0.0 M, 0.000% Params, 0.0 GFLOPs, 0.000% FLOPs, )
    (convs_bridge): ModuleList(
      6.197 M, 10.003% Params, 14.177 GFLOPs, 7.250% FLOPs, 
      (0): ConvModule(
        4.721 M, 7.620% Params, 4.722 GFLOPs, 2.415% FLOPs, 
        (conv): Conv2d(4.719 M, 7.617% Params, 4.719 GFLOPs, 2.413% FLOPs, 512, 1024, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
        (bn): BatchNorm2d(0.002 M, 0.003% Params, 0.002 GFLOPs, 0.001% FLOPs, 1024, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (activate): LeakyReLU(0.0 M, 0.000% Params, 0.001 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
      )
      (1): ConvModule(
        1.181 M, 1.906% Params, 4.725 GFLOPs, 2.416% FLOPs, 
        (conv): Conv2d(1.18 M, 1.904% Params, 4.719 GFLOPs, 2.413% FLOPs, 256, 512, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
        (bn): BatchNorm2d(0.001 M, 0.002% Params, 0.004 GFLOPs, 0.002% FLOPs, 512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (activate): LeakyReLU(0.0 M, 0.000% Params, 0.002 GFLOPs, 0.001% FLOPs, negative_slope=0.1, inplace=True)
      )
      (2): ConvModule(
        0.295 M, 0.477% Params, 4.731 GFLOPs, 2.419% FLOPs, 
        (conv): Conv2d(0.295 M, 0.476% Params, 4.719 GFLOPs, 2.413% FLOPs, 128, 256, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
        (bn): BatchNorm2d(0.001 M, 0.001% Params, 0.008 GFLOPs, 0.004% FLOPs, 256, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
        (activate): LeakyReLU(0.0 M, 0.000% Params, 0.004 GFLOPs, 0.002% FLOPs, negative_slope=0.1, inplace=True)
      )
    )
    (convs_pred): ModuleList(
      0.458 M, 0.739% Params, 1.833 GFLOPs, 0.937% FLOPs, 
      (0): Conv2d(0.261 M, 0.422% Params, 0.261 GFLOPs, 0.134% FLOPs, 1024, 255, kernel_size=(1, 1), stride=(1, 1))
      (1): Conv2d(0.131 M, 0.211% Params, 0.523 GFLOPs, 0.268% FLOPs, 512, 255, kernel_size=(1, 1), stride=(1, 1))
      (2): Conv2d(0.066 M, 0.106% Params, 1.049 GFLOPs, 0.536% FLOPs, 256, 255, kernel_size=(1, 1), stride=(1, 1))
    )
  )
)
==============================
Input shape: (3, 1280, 800)
Flops: 195.55 GFLOPs
Params: 61.95 M
==============================
!!!Please be cautious if you use the results in papers. You may need to check if all ops are supported and verify that the flops computation is correct.

What is the feature you are proposing to solve the problem?

None

What alternatives have you considered?

when I use fvcore to calculate flops is the same error, because of the data_samples is None

# Copyright (c) OpenMMLab. All rights reserved.
import argparse

import torch
from fvcore.nn import FlopCountAnalysis, flop_count_table
from mmengine import Config

from mmdet.registry import MODELS
from mmdet.utils import register_all_modules
from mmengine.runner import Runner

register_all_modules()

def parse_args():
    parser = argparse.ArgumentParser(description='Train a detector')
    parser.add_argument('config', help='train config file path')
    parser.add_argument(
        '--shape',
        type=int,
        nargs='+',
        default=[640, 640],
        help='input image size')
    args = parser.parse_args()
    return args


def main():

    args = parse_args()

    if len(args.shape) == 1:
        h = w = args.shape[0]
    elif len(args.shape) == 2:
        h, w = args.shape
    else:
        raise ValueError('invalid input shape, please use --shape h w')

    input_shape = (1, 3, h, w)
    cfg = Config.fromfile(args.config)

    # dataloader = Runner.build_dataloader(cfg.val_dataloader)

    model = MODELS.build(cfg.model)

    # for idx, data_batch in enumerate(dataloader):
    #     print(idx, data_batch)
    #     break

    # flops = FlopCountAnalysis(model, (torch.ones(input_shape), data_batch['data_samples']))
    # flops = FlopCountAnalysis(model,{"inputs": data_batch['inputs'],"data_samples": data_batch['data_samples']})
    # flops = FlopCountAnalysis(model,data_batch['inputs'][0])
    flops = FlopCountAnalysis(model,torch.ones(input_shape))

    # params = parameter_count_table(model)
    flops_data = flop_count_table(flops)

    print(flops_data)

    print('!!!Please be cautious if you use the results in papers. '
          'You may need to check if all ops are supported and verify that the '
          'flops computation is correct.')


if __name__ == '__main__':
    main()
@RangiLyu
Copy link
Member

RangiLyu commented Oct 8, 2022

MMEngine will provide this feature.

@vansin
Copy link
Collaborator Author

vansin commented Oct 8, 2022

MMEngine will provide this feature.

thanks~

@ZwwWayne ZwwWayne transferred this issue from open-mmlab/mmdetection Oct 9, 2022
@zhouzaida
Copy link
Collaborator

supported by #779

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants