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 specifying scales in preprocessing div2k dataset #472

Merged
merged 10 commits into from
Aug 12, 2021
Merged

Support specifying scales in preprocessing div2k dataset #472

merged 10 commits into from
Aug 12, 2021

Conversation

wileewang
Copy link
Contributor

@wileewang wileewang commented Aug 9, 2021

Motivation

We want build a data set like DIV2KRK which contain low-quality(LQ) images, ground-truth(GT) images and blur kernels and use it for training models like Deep Alternating Network(DAN), which means we also need to crop them into sub images. This PR create a scripts to generate this data set.

Modification

We create a new file preprocess_div2k_dataset_bsr.py, a copy of preprocess_div2k_dataset.py, and then add a function to generate blur kernel according to configuration, and we no longer use DIV2K LR images to crop into sub images but apply pipeline used in DAN's paper: GT-->blur-->down-sampling-->LQ, and we also stored corresponding blur kernel in .mat format using same base name.

wilee added 2 commits August 9, 2021 12:18
Add a new scripts to generate training data pairs for blind super resolution
made some modification
@ckkelvinchan
Copy link
Member

Hello, thank you for your contribution. May I ask why do you pre-generate the LR images instead of generating the LR during training? I think the degradations could be more diverse if we apply the degradations during training.

@wileewang
Copy link
Contributor Author

Hello, thank you for your contribution. May I ask why do you pre-generate the LR images instead of generating the LR during training? I think the degradations could be more diverse if we apply the degradations during training.

Yes, you're right. Maybe I think pre-generating low-quality images is convenient and intuitive, and if we generate lq images during training, we will no longer need LR sub images generated by preprocess_div2k_dataset.py.

Thanks for your advice! I have a new idea. We add a new argument in preprocess_div2k_dataset.py to control whether generating LR sub images or not as more and more researches are performing more complex modeling of the degradation process, not just down-sampling. And we can degrade images during training.

1.remove preprocess_div2k_dataset_bsr.py;
2.add a new argument into preprocess_div2k_dataset.py script to control
whether crop LR images;
3.modify corresponding README.md and README_zh-CN.md.
@wileewang
Copy link
Contributor Author

wileewang commented Aug 10, 2021

I have modified my pull request by

  1. Removing preprocess_div2k_dataset_bsr.py
  2. Adding a new argument --custom-degradation into preprocess_div2k_dataset.py to control whether crop bicubic LR images
  3. Adding some illustrations into README.md and README_zh-CN.md

@ckkelvinchan
Copy link
Member

I have modified my pull request by

  1. Removing preprocess_div2k_dataset_bsr.py
  2. Adding a new argument --custom-degradation into preprocess_div2k_dataset.py to control whether crop bicubic LR images
  3. Adding some illustrations into README.md and README_zh-CN.md

I think you can simply use an argument scale to specify whether you want to process the downsampled images.

If scale = [], then only the HR images will be processed.

wilee and others added 4 commits August 10, 2021 20:01
Replace custom-degradation argument with scale
Restore README.md and README_zh-CN.md
Restore README.md and README_zh-CN.md
@wileewang
Copy link
Contributor Author

I have modified my pull request by

  1. Removing preprocess_div2k_dataset_bsr.py
  2. Adding a new argument --custom-degradation into preprocess_div2k_dataset.py to control whether crop bicubic LR images
  3. Adding some illustrations into README.md and README_zh-CN.md

I think you can simply use an argument scale to specify whether you want to process the downsampled images.

If scale = [], then only the HR images will be processed.

Thanks for your advice. I have updated it.

@wileewang wileewang requested a review from ckkelvinchan August 10, 2021 14:30
@innerlee innerlee changed the title add scripts for generating dataset used in blind super resolution Support specifying scales in preprocessing div2k dataset Aug 11, 2021
@codecov
Copy link

codecov bot commented Aug 12, 2021

Codecov Report

Merging #472 (7013f70) into master (f9c9a95) will decrease coverage by 0.01%.
The diff coverage is n/a.

❗ Current head 7013f70 differs from pull request most recent head 8d40b78. Consider uploading reports for the commit 8d40b78 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master     #472      +/-   ##
==========================================
- Coverage   80.56%   80.54%   -0.02%     
==========================================
  Files         190      190              
  Lines       10338    10338              
  Branches     1533     1533              
==========================================
- Hits         8329     8327       -2     
- Misses       1780     1781       +1     
- Partials      229      230       +1     
Flag Coverage Δ
unittests 80.52% <ø> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
...ls/components/stylegan2/generator_discriminator.py 84.93% <0.00%> (-1.21%) ⬇️

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 f9c9a95...8d40b78. Read the comment docs.

@innerlee innerlee merged commit 7719dc0 into open-mmlab:master Aug 12, 2021
Yshuo-Li pushed a commit to Yshuo-Li/mmediting that referenced this pull request Jul 15, 2022
)

* First commit!
Add a new scripts to generate training data pairs for blind super resolution

* Second commit!
made some modification

* Third commit
1.remove preprocess_div2k_dataset_bsr.py;
2.add a new argument into preprocess_div2k_dataset.py script to control
whether crop LR images;
3.modify corresponding README.md and README_zh-CN.md.

* Fourth Commit
Replace custom-degradation argument with scale

* Fifth Commit
Restore README.md and README_zh-CN.md

* Sixth Commit
Restore README.md and README_zh-CN.md

* Update README_zh-CN.md

* update annotations

* scale -> scales

Co-authored-by: lizz <[email protected]>
@OpenMMLab-Coodinator
Copy link

Hi @wileewang !First of all, we want to express our gratitude for your significant PR in this project. Your contribution is highly appreciated, and we are grateful for your efforts in helping improve this open-source project during your personal time. We believe that many developers will benefit from your PR.

We would also like to invite you to join our Special Interest Group (SIG) private channel on Discord, where you can share your experiences, ideas, and build connections with like-minded peers. To join the SIG channel, simply message moderator— OpenMMLab on Discord or briefly share your open-source contributions in the #introductions channel and we will assist you. Look forward to seeing you there! Join us :https://discord.gg/raweFPmdzG

If you are Chinese or have WeChat,welcome to join our community on WeChat. You can add our assistant :openmmlabwx. Please add "mmsig + Github ID" as a remark when adding friends:)
Thank you again for your contribution❤

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.

4 participants