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

Support mmcv bricks in flops compuation #715

Merged
merged 1 commit into from
Dec 15, 2020

Conversation

innerlee
Copy link
Contributor

Fix #675

Running the script in that issue

before:

Sequential(
  (0): Conv2d(30, 30, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
  (1): ConvTranspose2d(30, 30, kernel_size=(3, 3), stride=(2, 2), output_padding=(1, 1), bias=False)
)
Sequential(
  (0): Conv2d(30, 30, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
  (1): ConvTranspose2d(30, 30, kernel_size=(3, 3), stride=(2, 2), output_padding=(1, 1), bias=False)
)
Sequential(
  0.008 M, 50.000% Params, 0.531 GFLOPs, 100.000% FLOPs, 
  (0): Conv2d(0.008 M, 50.000% Params, 0.531 GFLOPs, 100.000% FLOPs, 30, 30, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
  (1): ConvTranspose2d(0.0 M, 0.000% Params, 0.0 GFLOPs, 0.000% FLOPs, 30, 30, kernel_size=(3, 3), stride=(2, 2), output_padding=(1, 1), bias=False)
)
Sequential(
  0.016 M, 100.000% Params, 1.062 GFLOPs, 100.000% FLOPs, 
  (0): Conv2d(0.008 M, 50.000% Params, 0.531 GFLOPs, 50.000% FLOPs, 30, 30, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
  (1): ConvTranspose2d(0.008 M, 50.000% Params, 0.531 GFLOPs, 50.000% FLOPs, 30, 30, kernel_size=(3, 3), stride=(2, 2), output_padding=(1, 1), bias=False)
)

after:

Sequential(
  (0): Conv2d(30, 30, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
  (1): ConvTranspose2d(30, 30, kernel_size=(3, 3), stride=(2, 2), output_padding=(1, 1), bias=False)
)
Sequential(
  (0): Conv2d(30, 30, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
  (1): ConvTranspose2d(30, 30, kernel_size=(3, 3), stride=(2, 2), output_padding=(1, 1), bias=False)
)
Sequential(
  0.016 M, 100.000% Params, 1.062 GFLOPs, 100.000% FLOPs, 
  (0): Conv2d(0.008 M, 50.000% Params, 0.531 GFLOPs, 50.000% FLOPs, 30, 30, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
  (1): ConvTranspose2d(0.008 M, 50.000% Params, 0.531 GFLOPs, 50.000% FLOPs, 30, 30, kernel_size=(3, 3), stride=(2, 2), output_padding=(1, 1), bias=False)
)
Sequential(
  0.016 M, 100.000% Params, 1.062 GFLOPs, 100.000% FLOPs, 
  (0): Conv2d(0.008 M, 50.000% Params, 0.531 GFLOPs, 50.000% FLOPs, 30, 30, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)
  (1): ConvTranspose2d(0.008 M, 50.000% Params, 0.531 GFLOPs, 50.000% FLOPs, 30, 30, kernel_size=(3, 3), stride=(2, 2), output_padding=(1, 1), bias=False)
)

Signed-off-by: lizz <lizz@sensetime.com>
@codecov
Copy link

codecov bot commented Dec 15, 2020

Codecov Report

Merging #715 (5735233) into master (e30dc4f) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #715   +/-   ##
=======================================
  Coverage   64.90%   64.91%           
=======================================
  Files         135      135           
  Lines        7870     7872    +2     
  Branches     1396     1396           
=======================================
+ Hits         5108     5110    +2     
  Misses       2497     2497           
  Partials      265      265           
Flag Coverage Δ
unittests 64.91% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
mmcv/cnn/utils/flops_counter.py 93.18% <100.00%> (+0.06%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e30dc4f...3084b0e. Read the comment docs.

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

Successfully merging this pull request may close these issues.

get_model_complexity_info does not count Flops for build_upsample_layer('deconv')
3 participants