Image Enhancement with ESRGAN using TensorFlow¶
Generative Adversarial Networks (GANs) are a branch of deep learning used for generative modeling. They consist of 2 neural networks that act as adversaries, the Generator and the Discriminator. The Generator is assigned to generate fake images that look real, and the Discriminator needs to correctly identify the fake ones.
In this example, you will learn how to use a ESRGAN generator to upscale images x4 better than any upscaling algorithm like bicubic or bilinear, using the generator available on TensorFlow Hub. ESRGAN is short for Enhanced Super-Resolution Generative Adversarial Networks.
The source code for this example can be found in the examples/sr package.
To configure your development environment, follow setup.
ESRAGN is trained on the DIV2K dataset. The model is very simple to interact with, the input is a batch of images and so is the output.
Thus, the input to the translator will be a list of images like so:
List<Image> input = Arrays.asList( ImageFactory.getInstance().fromFile(Paths.get("src/test/resources/fox.png")) );
Build the project and run¶
Use the following commands to run the project:
cd examples ./gradlew run -Dmain=ai.djl.examples.inference.sr.SuperResolution
Here is an example, we compare the original image to the traditional Bicubic upscaling algorithm