A DCGAN to generate anime faces using custom mined dataset

Overview

Anime-Face-GAN-Keras

A DCGAN to generate anime faces using custom dataset in Keras.

Dataset

The dataset is created by crawling anime database websites using curl. The script anime_dataset_gen.py crawls and processes the images into 64x64 PNG images with only the faces cropped.

Examples of the dataset:

trainimg1.png trainimg2.png trainimg3.png

Network

This implementation of GAN uses deconv layers in Keras (networks are initialized in the GAN_Nets.py file). I have tried various combinations of layers such as :
Conv + Upsampling
Conv + bilinear
Conv + Subpixel Upscaling
But none of these combinations yielded any decent results. The case was either GAN fails to generate images that resembles faces or it generates same or very similar looking faces for all batches (generator collapse). But these were my results, maybe techniques such as mini-batch discrimination, z-layers could be used to get better results.

Training

Only simple GAN training methods are used. Training is done on about 22,000 images. Images are not loaded entirely into memory instead, each time a batch is sampled, only the sampled images are loaded. An overview of what happens each step is:
-Sample images from dataset (real data)
-Generate images using generator (gaussian noise as input) (fake data)
-Add noise to labels of real and fake data
-Train discriminator on real data -Train discriminator on fake data
-Train GAN on fake images and real data labels
Training is done for 10,000 steps. In my setup (GTX 660; i5 4670) it takes 10-11 secs for each step.

Loss plot:

realvsfakeloss.png

genloss.png

Full Training as a GIF: (images sampled every 100 step)

movie.gif

Faces generated at the end of 10,000 steps:

finalimg2.png finalimg3.png finalimg4.png

The faces look pretty good IMO, might look more like an actual face with more training, more data and probably with a better network.

Resources

https://github.com/tdrussell/IllustrationGAN
https://github.com/jayleicn/animeGAN
https://github.com/forcecore/Keras-GAN-Animeface-Character

https://distill.pub/2016/deconv-checkerboard/
https://kivantium.net/keras-bilinear

You might also like...
A simple rest api serving a deep learning model that classifies human gender based on their faces. (vgg16 transfare learning)
A simple rest api serving a deep learning model that classifies human gender based on their faces. (vgg16 transfare learning)

this is a simple rest api serving a deep learning model that classifies human gender based on their faces. (vgg16 transfare learning)

High accurate tool for automatic faces detection with landmarks
High accurate tool for automatic faces detection with landmarks

faces_detanator High accurate tool for automatic faces detection with landmarks. The library is based on public detectors with high accuracy (TinaFace

Code of 3D Shape Variational Autoencoder Latent Disentanglement via Mini-Batch Feature Swapping for Bodies and Faces

3D Shape Variational Autoencoder Latent Disentanglement via Mini-Batch Feature Swapping for Bodies and Faces Installation After cloning the repo open

Example-custom-ml-block-keras - Custom Keras ML block example for Edge Impulse

Custom Keras ML block example for Edge Impulse This repository is an example on

PyTorch implementation of a Real-ESRGAN model trained on custom dataset

Real-ESRGAN PyTorch implementation of a Real-ESRGAN model trained on custom dataset. This model shows better results on faces compared to the original

A repo to show how to use custom dataset to train s2anet, and change backbone to resnext101
A repo to show how to use custom dataset to train s2anet, and change backbone to resnext101

A repo to show how to use custom dataset to train s2anet, and change backbone to resnext101

For holding anime-related object classification and detection models

Animesion An end-to-end framework for anime-related object classification, detection, segmentation, and other models. Update: 01/22/2020. Due to time-

[Open Source].  The improved version of AnimeGAN. Landscape photos/videos to anime
[Open Source]. The improved version of AnimeGAN. Landscape photos/videos to anime

[Open Source]. The improved version of AnimeGAN. Landscape photos/videos to anime

 StyleGAN2 Webtoon / Anime Style Toonify
StyleGAN2 Webtoon / Anime Style Toonify

StyleGAN2 Webtoon / Anime Style Toonify Korea Webtoon or Japanese Anime Character Stylegan2 base high Quality 1024x1024 / 512x512 Generate and Transfe

Comments
  • Assistance editing GAN for different image set

    Assistance editing GAN for different image set

    Hi @pavitrakumar78,

    I wanted to get in touch to see if you could possibly assist with an issue I am having. I am using your GAN_training.py to see if it can be applied to a different image set. The dimensions of the image are 3232x208. The images themselves are of video game level. As such I tried to change your code in the GAN_training.py so that it could use the game levels images as inputs. I also wish to output the generated images from the GAN as single images and not as 4x4 images as your code does.

    Please see screenshots attached that indicate areas where I have changed your code. Screenshot 1 - I have changed the figsize and gridspec size to 1x1 screenshot1

    screenshot2 - changed the image shape to 3232x208, the shape of the images i am trying to use as well as batch size and number of steps. screenshot2

    screenshot3 - changed the image_shape in the GAN_Nets.py file for get_disc_normal function screenshot3

    screenshot4 - error message i receive when running the GAN_training.py screenshot4

    I would really appreciate your help, or any guidance you can give me as to how to resolve the issue shown in screenshot 4. Please let me know if you need anymore information.

    Thanks.

    opened by vinaysp 7
  • Program Installation files missing

    Program Installation files missing

    Hello, i have this issue where i download the folder, but in the folder there's no .exe file to install the application. Could you help me find the .exe file?

    opened by Blazeolmo 1
  • Generating the refined image

    Generating the refined image

    Hey Pavitra,

    Really loved your implementation of Anime Face GAN. I just had one minor doubt. I am new in the field of ML. So I was wondering that since the dataset consists of around 1000 images, our output generated in the jupyter notebook codes shows only 16 images (maybe just a glimpse of some images). But how can I generate/recreate the rest of the images? Like do I need to upload the image with a new python code in a fresh jupyter notebook and then again train my model on that single image? I would really appreciate it if you can help me out with this.

    opened by psychedelic2007 1
Owner
Pavitrakumar P
MS in Computer Science (spec. in ML), Georgia Tech
Pavitrakumar P
A highly efficient, fast, powerful and light-weight anime downloader and streamer for your favorite anime.

AnimDL - Download & Stream Your Favorite Anime AnimDL is an incredibly powerful tool for downloading and streaming anime. Core features Abuses the dev

KR 759 Jan 8, 2023
Little tool in python to watch anime from the terminal (the better way to watch anime)

ani-cli Script working again :), thanks to the fork by Dink4n for the alternative approach to by pass the captcha on gogoanime A cli to browse and wat

Harshith 4.5k Dec 31, 2022
This repo tries to recognize faces in the dataset you created

YÜZ TANIMA SİSTEMİ Bu repo oluşturacağınız yüz verisetlerini tanımaya çalışan ma

Mehdi KOŞACA 2 Dec 30, 2021
Computational inteligence project on faces in the wild dataset

Table of Contents The general idea How these scripts work? Loading data Needed modules and global variables Parsing the arrays in dataset Extracting a

tooraj taraz 4 Oct 21, 2022
Deeper DCGAN with AE stabilization

AEGeAN Deeper DCGAN with AE stabilization Parallel training of generative adversarial network as an autoencoder with dedicated losses for each stage.

Tyler Kvochick 36 Feb 17, 2022
DCGAN LSGAN WGAN-GP DRAGAN PyTorch

Recommendation Our GAN based work for facial attribute editing - AttGAN. News 8 April 2019: We re-implement these GANs by Tensorflow 2! The old versio

Zhenliang He 408 Nov 30, 2022
Simple Python project using Opencv and datetime package to recognise faces and log attendance data in a csv file.

Attendance-System-based-on-Facial-recognition-Attendance-data-stored-in-csv-file- Simple Python project using Opencv and datetime package to recognise

null 3 Aug 9, 2022
Python scripts to detect faces in Python with the BlazeFace Tensorflow Lite models

Python scripts to detect faces using Python with the BlazeFace Tensorflow Lite models. Tested on Windows 10, Tensorflow 2.4.0 (Python 3.8).

Ibai Gorordo 46 Nov 17, 2022
This is an easy python software which allows to sort images with faces by gender and after by age.

Gender-age Classifier This is an easy python software which allows to sort images with faces by gender and after by age. Usage First install Deepface

Claudio Ciccarone 6 Sep 17, 2022
Source code and notebooks to reproduce experiments and benchmarks on Bias Faces in the Wild (BFW).

Face Recognition: Too Bias, or Not Too Bias? Robinson, Joseph P., Gennady Livitz, Yann Henon, Can Qin, Yun Fu, and Samson Timoner. "Face recognition:

Joseph P. Robinson 41 Dec 12, 2022