This model has been inspired by CartoonGAN. The GAN (generative adversarial network) framework consists of two Convolutional networks. First, is the Generator(G) network whose goal is to produce output that can fool the Discriminator(D) network. On the other hand, discriminator aims to detect whether the image is a synthesized version or belongs to a real dataset. In this project, Generator and Discriminator was designed to produce the cartoon images for real dataset by preserving the structure of the real image. In other words, Generator consisted of three main parts i.e. encoder which encodes the features of the images, transformer which transformed the image to match the target manifold and decoder which takes the transformed image as input and produces the cartoon version for real image. Discriminator was a convolution network with a sigmoid layer in the output to detect whether the image belongs to a real dataset or a fake dataset and provides adversarial loss for G. Main objective was to optimize the loss function for the generator.
In the ArtifyGAN, residual blocks have been increased from 8 to 10 to capture the content of the real image more effectively in a lesser number of epochs. Also, removing the extra convolution block helped to improve the efficiency of the model by reducing the computation time. Hence, with this proposed model optimal and efficient results were achieved in lesser number of epochs i.e. at 79 epochs. For more details refer to the report here.
Also, the results were compared with other pretrained model such as JojoGAN, StyleGAN, AnimeGAN. From the image above we can see the that ArtifyGAN is able to preserve both content as well as comic style of the image.
To implement the model, refer to this notebook.
Install the Python Anaconda Environment and download the zip folder from the repository.Using the command prompt, navigate to the directory of the folder.
- python3 -m venv myenv
- source myenv/bin/activate
- python -m venv myenv
- myenv\Scripts\activate
pip install -r requirements.txt
python cartoon_image.py <path to real image>
For eg, python cartoon_image.py /Users/iqrabismi/Desktop/arizona.jpeg