Tencent / Real-SR

Real-World Super-Resolution via Kernel Estimation and Noise Injection
Apache License 2.0
788 stars 118 forks source link

color shift in SR output #6

Open devernay opened 4 years ago

devernay commented 4 years ago

There is a noticeable color shift in the output of Real-SR (at least with DF2K-JPEG, I didn't test other models).

That color-shift seems to be texture-dependent, and I'm a bit surprised that SR methods don't avoid this. Other SR methods seem to be flawed by the same issue.

Here's how to post-process the output of Real-SR to remove the color shift: downscale the SR image, compute the difference with the LR image, Gaussian blur, upscale, add to the SR image. All computation is done in linear color space. This gives this one-line G'MIC script (edited to work also with older versions of gmic):

gmic image.jpg image_4x.jpg -srgb2rgb [1] -resize[1] 25%,25%,[0],[0],2 -sub[0,1] -blur[0] 2 -resize[0] 400%,400%,[0],[0],3 -add -rgb2srgb -output image_4x_nocolorshift.jpg
devernay commented 4 years ago

Here's a simple image that shows the color shift. You will see that DF2K has issues with a simple 1-piwel checkerboard pattern. DF2K_JPEG has issues with all patterns (maybe that's because it considers them as JPEG artifact, but still they should turn out gray, not yellow).

Input image (from the excellent page on Gamma errors in image resizing http://www.ericbrasseur.org/gamma.html): gamma_2 2 Output with DF2K (issue visible mainly on the 1x1 checkerboard which gets a dark blue taint): gamma_2 2 output with DF2K_JPEG (almost everything gets yellowed): gamma_2 2

SEt-t commented 4 years ago

The issue is very noticeable on some real images too. Proposed G'MIC script helps but still can't correct all the errors. Example image: image DF2K_JPEG image_scaled DF2K did better job with colors but much worse with other artifacts image_scaled_DF2K