Testing the GANN waters

Testing out basic GANN tutorial models to generate abstract art.

Testing the GANN waters

I read through and ran some of the items in "Generative Deep Learning". The book gets into the section about teaching the ML to paint, to write music, to write books. The paint section was useful. The book explains style transfer and the representational space.

I started researching a few other models and noting what they were used for. I'll try out styleGann next but for now I settled on a basic tutorial i found here https://levelup.gitconnected.com/painting-portraits-using-gans-with-pytorch-afeb69b1c5a1

The code is meant for abstract art style transfer and the generation of new art. It is using pytorch, keras, and tensorboard. The author of the code does a pretty good job of resizing and massaging the image data, all taken from Kaggle. The tutorial sets up tensorboard for monitoring and is a pretty good template for a GANN project. It has all the pieces in place.

Training First Epochs

I have ~11,500 images in the abstract folder. I resized them to 128x128 using the author's method. I noticed my GPU is not being used because i do not have a CUDA installation. So with CPU only, a batch size of about 64 , i should have around 180 batches per epoch.  It took about 5 to 6 minutes to run through a full epoch. Here are the generated vs. real images after a single epoch

Reference images Epoch 1
Epoch 1
Epoch 3
Epoch 5

We can start to see a transition from colorless shapeless blobs to a patchwork with color and more detail within only 5 epochs of training. For now I'll let it run and take a look later tonight while I fix my Cuda issues. CPU only is not a great way to train any deep learning model.

One Day later...

100 Epoch

This was the final output after 100 epochs, honestly not that bad. (considering this was on a modern art data set).

Performance notes

I ran this program and trained the same data set 3 times.  
1 - (4.5 hours) Gaming Desktop - CPU only
2 - (16 Hours Laptop - 2cnd gen I7 CPU only
3 - (25 minutes) Gaming Desktop - CPU and single GPU (1080ti)

I will say that getting the CUDA GPU support to work was a bit of a hassle but worth it.  

Follow up and Scaling issues

These are some of the generated images and then the 'scaled' up versions using bilinear interpolation, sadly the interpolation can only do so much, and its not enough. Take a look

Original
Interpolation and scaled , result bad