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

[Feature] Support FLOPs calculation of video SR models #309

Merged
merged 3 commits into from
May 15, 2021

Conversation

ckkelvinchan
Copy link
Member

As discussed in #306, Existing get_flops.py does not accept video inputs with size (t, c, h, w). Therefore, the function is not compatible with video SR models such as EDVR, BasicVSR.

This PR adds the support of FLOPs computation of video SR models, by accepting --shape t c h w. For example, for BasicVSR, we can compute the FLOPs by using the following command.

python tools/get_flops.py configs/restorers/basicvsr/basicvsr_vimeo90k_bi.py --shape 5 3 180 320

@codecov
Copy link

codecov bot commented May 14, 2021

Codecov Report

Merging #309 (a59222e) into master (909670e) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #309   +/-   ##
=======================================
  Coverage   80.74%   80.74%           
=======================================
  Files         163      163           
  Lines        8147     8147           
  Branches     1194     1194           
=======================================
  Hits         6578     6578           
  Misses       1425     1425           
  Partials      144      144           
Flag Coverage Δ
unittests 80.74% <ø> (ø)

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


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 909670e...a59222e. Read the comment docs.

split_line = '=' * 30
print(f'{split_line}\nInput shape: {input_shape}\n'
f'Flops: {flops}\nParams: {params}\n{split_line}')
print('!!!If you are testing a recurrent network, please divide the '
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why it should be divided?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since a recurrent network (e.g. BasicVSR) takes N frames as inputs and outputs N frames, therefore the FLOPs for each frame should be the output FLOPs divided by N.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, print this info only when the input is N frames, and change "recurrent network" to some other name. N frame to N frame does not have to be recurrent

@innerlee innerlee merged commit 1465ae5 into open-mmlab:master May 15, 2021
@ckkelvinchan ckkelvinchan deleted the flops branch May 15, 2021 06:36
Yshuo-Li pushed a commit to Yshuo-Li/mmediting that referenced this pull request Jul 15, 2022
* Support FLOPs calculation of video SR models

* Modify printscreen

* revised message
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.

2 participants