Magic baby is a household animation , Let's confirm today whether we can use deep learning to automatically create a new one for him Pokemon.
I finally managed to use the generated countermeasures network （GAN） Generated a similar Pokemon Image , But this image doesn't look like a magic baby .
Although the attempt failed , But I think other people might like the process , Now share him .
<>GAN Generate countermeasure network
I don't want to spend a lot of time here GAN What's this , But the picture above is just a very simple explanation process .
Trained two networks - Discriminators and generators . Generators learn how to absorb random noise and generate images that look like images from training data .
It sends the generated image to the discriminator network , The discriminator network is trained to recognize real images and generated images .
Generator optimized , It can cheat the discriminator better , Discriminator optimized , Can better detect the generated image . therefore , They both made progress together .
therefore , My assumption is , I can train with real magic baby images as a training set GAN. The result will be a generator , And then we will be able to create new magic babies !
My first challenge is to find the image of the magic baby . Fortunately, ,Kaggle Data set rescued !
Some people have thought of similar ideas , Even though it sounds like he's building a new one Pokemon Not very successful in image , But because he took the time to collect 800 Amplitude image , So I decided to upload them to Kaggle data set . It saves me a lot of time .
Let's take a look at this dataset ：
This is a piece. Garlic bastard Frog seeds Pictures , Size is 256*256
Now , With data , The next step is to choose what to use GAN type . There may be hundreds GAN Variants , But in the past DCGAN Good results can be seen .
DCGAN All fully connected layers are eliminated from the neural network , Supersampling with transposed convolution , Parallel convolution span （ Among other things ） Instead of maximum pooling .
I like it DCGAN, Because of what I've tried GAN Comparison , They seem to be more robust , Therefore, it is easier to train without major adjustment of super parameters .
Actually ,DCGAN Very popular , So that PyTorch The example of . Equally important , Their example can read input directly from a folder .
therefore , Use the following command , I can start training me GAN：
python main.py --dataset folder --dataroot /pokemon/ --cuda --niter 10000
This command reads images from folders , In possession of 8 Working program GPU Run on to load data , And run 10,000 Secondary iteration .
Factual proof , This problem needs to be solved 10,000 Secondary iteration , But I want to see how far I can push . Let's see !
The first step starts with an unknown network , So it's just noise ：
each box They are all one. 64 x 64 Pixel image , It's trying to generate a magic baby from our generator . Because our grid is 8 x 8, So we try to build 64 Different kinds of magic babies .
I shrink the image to 64 x 64, Because this algorithm becomes unstable when trying to generate a larger image .
50 After iterations , It's kind of interesting
150 Secondary iteration , The image becomes clear
3,700 After that , There will be some good pictures . Thereafter , It started to tend to produce worse results ：
These don't look like magic babies at all !
But please reduce the browser to 25％ About , Then check again . In the distance , They look amazingly like real magic babies .
Why? ? Because we are 64 x 64 Image for training , So it's easy to confuse the discriminator with images that look and color like Pokemon , So the generator doesn't need to be improved .
<> Next step ?
In my opinion , The obvious next step is to train for higher resolution GAN. Actually , I've tried it a little bit .
My first attempt was to rewrite PyTorch Code to shrink to 256 x 256 image . This code is valid , however DCGAN Collapsed , I can't stabilize Xinlian .
I believe the main reason is that I only have about 800 Zhang image . And , Despite some data expansion , But not enough to train for higher resolution DCGAN.
Then? , I try to use relativistic GAN, The GAN Successfully trained high-resolution data with smaller data sets , But it doesn't work .
For now , The problem should be in the data , Too little data , Still can't meet the needs of training . But I'm going to try something else , To produce higher resolution Pokemon, If I have to work , I will release the technology I use .