• Stars
    star
    197
  • Rank 193,902 (Top 4 %)
  • Language
    Python
  • Created almost 7 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A DCGAN to generate anime faces using custom mined dataset

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

More Repositories

1

Python-Custom-Digit-Recognition

Using OpenCV in python to recognize digits in a scanned page of handwritten digits.
Python
109
star
2

Street-View-House-Numbers-SVHN-Detection-and-Classification-using-CNN

A 2-CNN pipeline to do both detection (using bounding box regression) and classification of numbers on SVHN dataset.
Python
59
star
3

Playing-custom-games-using-Deep-Learning

Implementation of Google's paper on playing atari games using deep learning in python.
Python
27
star
4

Machine-Learning-Python-Implementations

Basic ML algorithms written from scratch in python using numpy.
Python
7
star
5

Python-telegram-bot-GetPDFbot

A Telegram bot for getting books for given book name or author name.
Python
4
star
6

DeepDreamsGIF

A python script to convert GIF into a Google's DeepDream style GIFs.
Python
4
star
7

Python-Genetic-Cars-Box2D

A python implementation of generating cars using genetic programming with Box2D library.
Python
3
star
8

Python-Solving-NP-Problem-Using-Genetic-Algorithms

Exploring different ways of solving an NP-Hard using genetic algorithms.
Python
3
star
9

Coursera-Data-Manipulation-At-Scale-Systems-and-Algorithms

My solutions for assignments in this course.
Python
3
star
10

Python-OpenCV-Paint

A simple web-cam paint program using Tkinter and OpenCV
Python
2
star
11

Java-Web-Crawler

A simple java web crawler to crawl a root link and store the results in a MySQL database
Java
2
star
12

Maze-Generator-and-Solver-Interactive

A C++ implementation of a NxN maze generation and solving (either by an algorithm or by user).
C++
2
star
13

Java-Web-Search-engine-and-Crawler

A java project demonstrating a simple web search engine
Java
2
star
14

Android-Optical-Text-Recognition-Tool

An android app to recognize printed text using Google's Teserract library.
C
1
star
15

Language-and-Library-usage-analysis-of-GitHub-repositories

A simple script to visualize the number of GitHub repositories created in a timeline for a given keyword and programming language. The primary idea is to get some statistics about the usage of libraries across different languages.
Python
1
star