XPixelGroup / BasicSR

Open Source Image and Video Restoration Toolbox for Super-resolution, Denoise, Deblurring, etc. Currently, it includes EDSR, RCAN, SRResNet, SRGAN, ESRGAN, EDVR, BasicVSR, SwinIR, ECBSR, etc. Also support StyleGAN2, DFDNet.
https://basicsr.readthedocs.io/en/latest/
Apache License 2.0
6.55k stars 1.15k forks source link

scale=1,Can it be used for image repair or image denoising? #208

Open qingfengmingyue opened 4 years ago

qingfengmingyue commented 4 years ago

scale=1,Can it be used for image repair or image denoising?

victorca25 commented 4 years ago

We've already done that, head to https://upscale.wiki/wiki/Model_Database for a lot of trained models, including 1x denoisers. Join here https://www.reddit.com/r/GameUpscale/ or on the Discord channel if you need any help

924175302 commented 4 years ago

We've already done that, head to https://upscale.wiki/wiki/Model_Database for a lot of trained models, including 1x denoisers. Join here https://www.reddit.com/r/GameUpscale/ or on the Discord channel if you need any help

I would like to ask a few questions: that is, ESRGAN generally uses a relatively high resolution image prepared by itself and then generates a relatively low resolution image. The first problem with my problem is that the image dataset I used was originally a relatively low resolution (200*380), and then I wanted to generate a higher resolution image through ESRGAN, so that would not generate a higher resolution. Rate of pictures? The second is that the original image contains noise. If a high-resolution image can be generated, will it affect the generated image? Will the noise be generated at the same time as the high-resolution image is generated? This is my question, thank you.

victorca25 commented 4 years ago

I don’t understand your questions well enough, but I think that for your first question, you need to use scale=1 and LR and HR (GT) have to be the same size, so it won’t upscale. Also, the framework will always crop the images to the defined size (default:128x128), so the actual images do not have such a high resolution. For the second, if your HR has noise, then yes, your model will learn to add noise. If you use my fork, I added a lot of noise types for augmentation that has been used for some denoising models (gaussian noise, dithering, JPEG compression and others)

924175302 commented 4 years ago

I don’t understand your questions well enough, but I think that for your first question, you need to use scale=1 and LR and HR (GT) have to be the same size, so it won’t upscale. Also, the framework will always crop the images to the defined size (default:128x128), so the actual images do not have such a high resolution. For the second, if your HR has noise, then yes, your model will learn to add noise. If you use my fork, I added a lot of noise types for augmentation that has been used for some denoising models (gaussian noise, dithering, JPEG compression and others)

First of all, thank you for your answer. Secondly, I will give a detailed explanation of my situation. I want to train my own picture to do super resolution. Through your previous answer, I learned that the model can also be used for denoising (scale=1), which is also part of what I want to do, but whether it is super-resolution or Denoising must have a corresponding GT image, and the problem I am having now is that my image does not have a corresponding GT image. The images I have have lower resolution and contain noise, so I would like to ask you, like If I am in such a situation, I can't do super-resolution and de-noising tasks, or I want to ask you, if you have any good suggestions or solutions for this situation.

victorca25 commented 4 years ago

You need to create a model with images that are not the images you want to denoise/upscale.

You need to get a dataset of image pairs, one set being the ground truth or high-resolution images and the other being the same images but degraded with the transformation you want your model to learn.

If it's denoising, your low-resolution pairs should contain the noise you want to fix and the GT will be the clean version of the image. Normally such pairs do not exist naturally, so the low-resolution pairs are created artificially (for example, adding Gaussian noise, Poisson noise, JPEG compression noise, etc).

If it's super-resolution (SR), the low-resolution pairs must be created using the interpolation method you want to revert. Many projects use Matlab's bicubic kernel as a standard to be able to compare with others on equal condition, but that's not the typical case found on normal images around the web, for example.

So you need to take into consideration exactly what you want to achieve in order to design your dataset. If you want to do some augmentations on the fly, like some noise types or downscaling algorithms provided by OpenCV then you can use my fork that allows for that without needed to create the LR pairs a priori: https://github.com/victorca25/BasicSR/wiki/Dataset-Augmentation

victorca25 commented 4 years ago

I also added other loss functions that may be useful depending on the task you want it to do, like SSIM/MS-SSIM and the HFEN losses and the total variation regularization. You can talk with more people working on those things in the reddit I linked before and the Discord channel there, it's not limited to just games.