Giter Site home page Giter Site logo

inference with jpg files about esrgan HOT 5 CLOSED

xinntao avatar xinntao commented on June 3, 2024 2
inference with jpg files

from esrgan.

Comments (5)

xinntao avatar xinntao commented on June 3, 2024 6

@suke27 @rahidz
Yes, if the input images are JPEG images, which means it was compressed by JPEG algorithms, the output is "blocky" with checkboard.

During training, the ESRGAN has not seen these blocky JPEG artifacts and was not trained with the objective to remove them. Therefore, in testing, the ESRGAN "enhancing" the jpg artifacts already present, as @rahidz said.

Turning it to PNG format cannot remove these checkerboard (8 pixels by 8 pixels) in JPEG compression. After upsampling the image, the checkerboard artifacts appear (8*4=32pixels, so you will see 32 by 32 pixels checkerboard artifacts).

It is a limitation that ESRGAN (also other SR algorithms using the bicubic downsampling kernels) cannot handle the problems. Acturally, the ESRGAN (and many other SR algorithms) is limited to a very strong assumption - the perfect bicubic downsampling kernels. Howevere, in real world, the input images have diverse down-sampling kernels and are also with blur, JPEG compression and noise.

So the algorithms are not satisfactory for images in real world. These problems are also the research topics that the community wants to solve.

You can try to improve it by 1) removing the JPEG artifacts first by other algorithms like ARCNN; 2) finetuning the network with datasets with JPEG artifacts, so that the ESRGAN can handle them.

from esrgan.

rahidz avatar rahidz commented on June 3, 2024 4

For some jpg files I try, the output is very “blocky”’ like there’s small but very noticeable square blocks covering the entire image. I assume this is simply ESRGAN “enhancing” the jpg artifacts already present, since this doesn't noticeably occur for all jpg files in my experience.

I’ve noticed slight improvement by converting the jpg to a png before I start, but it’s still not great.

from esrgan.

suke27 avatar suke27 commented on June 3, 2024 1

@xinntao for suggestion 2) finetuning the network with datasets with JPEG artifacts, so that the ESRGAN can handle them.
I try to finetune using jpg dataset for SRGAN, but not work well, also block and noise exist
but same training method for EDSR works well.

from esrgan.

xinntao avatar xinntao commented on June 3, 2024

@suke27 You can try to first pre-train the network with L2/L1 loss with JPEG compressed images. And then use the pre-trained model to train a GAN-based model.

I think, L2/L1 loss is a clear and effective loss to guide the network to remove the JPEG compression artifacts (Therefore, finetuning with jpg dataset works well for EDSR). But for SRGAN, the VGG + Adv loss may be not enough to remove the JPEG artifacts. So I think first pre-training the network with JPEG compressed images to let the network learn to remove JPEG artifacts will work.

from esrgan.

neilthefrobot avatar neilthefrobot commented on June 3, 2024

I was able to get around this by taking my HR training set, down sampling 4x, then converting it to .jpg with a low quality (high compression) and using that as my LR set. This way the network is seeing jpg artifacts as inputs and a non jpg artifact version as a target and it learns to convert between them. It actually worked very well too.

from esrgan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.