In the Name of God, the Beneficent, the Merciful
This is the implementation of image translation by conditional GAN architecture for Image translation using tensorflow
of a dataset of image pairs .
It is a dataset of 1207 paired images as input and target.
An example of the input image and its target image is shown below :
The Pix2Pix model and image translation techniques is to enable the generation of realistic images by learning the mapping between an input image and an output image. This mapping can be used for various tasks, such as image-to-image translation or image generation.
Pix2Pix is a specific model architecture proposed in a research paper titled "Image-to-Image Translation with Conditional Adversarial Networks" by Isola et al.
.
It uses a conditional generative adversarial network (cGAN)
to learn the mapping between input and output images.
The cGAN framework consists of two main components: a generator
network that generates the output image from the input image,.
and a discriminator
network that tries to distinguish between the generated output image and the real target image..
The generator and discriminator are trained together in an adversarial manner, where the generator aims to fool the discriminator and produce realistic outputs, while the discriminator tries to correctly classify the real and generated images.
Run pip install -r requirements.txt
script.
Dependencies are :
tensorflow==2.12.0
matplotlib==3.7.1
ipython==7.34.0
Pydub
Run dataset.py
script. to make train_dataset and test_dataset.
Run Model.py
script. to make model ready and will make some images from architecture of model.
Run Loss.py
script. to make model loss .
Run train.py
script.
You can see the output images after 1k steps.
Download the model from here.
Model's name is ckpt-10
.
Put the model in /training_checkpoints
folder.
Put the directory of your test image in Make_Inference.py
Run Make_Inference.py
on a test image.
My model, designed to handle images with arbitrary size
.
I have implemented a resizing mechanism that standardizes all input images to a consistent size.
IMG_WIDTH = 256
IMG_HEIGHT = 256
Run Prediction.py
script. to find some prediction result from test_dataset.
Run Compute_accuracy.py
script. to find the accurcy Average Pixel-wise
result.
Average Pixel-wise Accuracy: 0.78219396
by 50000 step
.
These are the result of test model using test_dataset after trainig the model.