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] Add MATLAB-like bicubic interpolation #507

Merged
merged 5 commits into from
Sep 8, 2021

Conversation

ckkelvinchan
Copy link
Member

Motivation

Existing image and video SR methods commonly use the imresize function in MATLAB to generate LR images. It means that one would need MATLAB to generate such LR images.

Modification

This PR adds the Python version of the MATLAB imresize function.

Note:
There is a slight difference between the official MATLAB implementation and this implementation. For instance, when using BasicVSR on REDS4, we achieve the following results:

  • Official MATLAB implementation: 31.4170/0.8909
  • This implementation: 31.4206/0.8911

@innerlee
Copy link
Contributor

innerlee commented Sep 1, 2021

One important thing is to be explicit about whether the implementation is the "same" as matlab's. From my point of view, this is a matlab-like resize. So some phrases in the docstring should be adjusted slightly to void giving a wrong impression.

@innerlee innerlee changed the title [Feature] Add MATLAB bicubic interpolation [Feature] Add MATLAB-like bicubic interpolation Sep 1, 2021
@innerlee
Copy link
Contributor

innerlee commented Sep 1, 2021

Also please rebase master to pass CI

@innerlee
Copy link
Contributor

innerlee commented Sep 2, 2021

And give licence info if the code is adapted from elsewhere

@ckkelvinchan ckkelvinchan removed the status/WIP work in progress normally label Sep 4, 2021
@codecov
Copy link

codecov bot commented Sep 4, 2021

Codecov Report

Merging #507 (2405775) into master (a408880) will increase coverage by 0.10%.
The diff coverage is 90.26%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #507      +/-   ##
==========================================
+ Coverage   80.50%   80.60%   +0.10%     
==========================================
  Files         190      191       +1     
  Lines       10344    10457     +113     
  Branches     1533     1553      +20     
==========================================
+ Hits         8327     8429     +102     
- Misses       1789     1794       +5     
- Partials      228      234       +6     
Flag Coverage Δ
unittests 80.57% <90.26%> (+0.10%) ⬆️

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

Impacted Files Coverage Δ
mmedit/datasets/pipelines/matlab_like_resize.py 90.17% <90.17%> (ø)
mmedit/datasets/pipelines/__init__.py 100.00% <100.00%> (ø)

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 a408880...2405775. Read the comment docs.

@innerlee innerlee merged commit 39710f1 into open-mmlab:master Sep 8, 2021
Yshuo-Li pushed a commit to Yshuo-Li/mmediting that referenced this pull request Jul 15, 2022
* Add matlab_bicubic.py

* Change function to class, add unittest

* update, pull from master

* Add license
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