Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,150,624 members, 7,809,337 topics. Date: Friday, 26 April 2024 at 08:00 AM

Generative Adversarial Networks ---- Training A Neural Network To Paint Art. - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Generative Adversarial Networks ---- Training A Neural Network To Paint Art. (420 Views)

Help With Recurrent Neural Network (RNN) Analysis / Generative Adversarial Networks Task [Fixed] / Project On Facial Recognition Using Artificial Neural Network (2) (3) (4)

(1) (Reply) (Go Down)

Generative Adversarial Networks ---- Training A Neural Network To Paint Art. by Enceladus(m): 2:16pm On Apr 24, 2021
Hello Everyone.

This a new side project I have been working on lately. I've been training a neural network to imagine, and paint drawings of the beautiful African culture.

Check some of the samples out.

3 Likes 1 Share

Re: Generative Adversarial Networks ---- Training A Neural Network To Paint Art. by Enceladus(m): 2:16pm On Apr 24, 2021
Neural networks have taken over the world. From learning to generate deep fakes, to god level skills in playing a game, to writing a movie manuscript (that was later acted), these giant matrices of floating-point numbers are gaining human-level intelligence in many fields, and they are laying the foundation for the super AGI, the technological singularity.

With these said accomplishments, neural networks still have some field/skills they are yet to master. An example is their ability to express innate creativity in tasks like Art making, music generation, abstract imaginations e.t.c. This post is about demonstrating how far we've come in designing creative AI.

Enter Generative Adversarial Network

1 Like

Re: Generative Adversarial Networks ---- Training A Neural Network To Paint Art. by Enceladus(m): 2:17pm On Apr 24, 2021
A Generative Adversarial Network is a method of training creative neural networks based on the following analogy.

A generator money heister network called the professor will be trained to generate counterfeit money, and another discriminator detective network holmes will be trained to differentiate between real and fake money.

On each training round, the professor generates fake money, we show the detector network either real or fake money and we train it to better differentiate the two. If we show the detective fake money from the professor, and it fools it as real money then the professor is getting better at generating fake money. Else if the detective is not fooled, we ask the detective network what gave the money up as fake and we give that information to the professor for him to be able to generate better counterfeit money.

This game continues for hours/days/months until it gets to a point where the detective can not identify if the money we show is from the professor or real, and it can only predict a 50/50 chance (Nash Equilibrium). This is when we say the generator has converged and can produce realistic-looking money.

The above training method (also called the min-max game) has been used in training our network to generate Art paintings centred around the African people.

2 Likes

Re: Generative Adversarial Networks ---- Training A Neural Network To Paint Art. by Enceladus(m): 2:17pm On Apr 24, 2021
I curated about 10,000 images of African centred art paintings from the internet. I then reviewed the images one by one deleting the ones that are not too artistic, or duplicates. After the review process, I was left with about 6,500 images of purely African origin art.

The next stage is preprocessing. Images were cropped and resized to the required dimensions. (256 x 256 then 512 x 512 later). Thanks to the script provided by the Nvidia lab guys it was very straightforward and fast.

I split the training into two phases to make learning faster. I trained the network to generate 256 x 256 images first. This is to aid the network in learning because it is easy to work with 256 x 256 pixels first, grasp the concept of painting then go on to generate paintings of 512 x 512.

1 Like

Re: Generative Adversarial Networks ---- Training A Neural Network To Paint Art. by Enceladus(m): 2:19pm On Apr 24, 2021
The first training phase took four days. The loss/inverse accuracy metric dropped from 75 to 17 in this phase. The model has learned what painting is by this phase. it can easily use different types of brush strokes, and it can also paint a different kind of art piece ranging from abstract to portrait e.t.c I didn't stop here because only 256 x 256 pixels images can be gotten from the network.

Below are some of the outputs from this phase.

1 Like

Re: Generative Adversarial Networks ---- Training A Neural Network To Paint Art. by Enceladus(m): 2:21pm On Apr 24, 2021
In the second phase, I upscaled the training images to 516 pixels and started training again from the last checkpoint. On the first batch, the loss shot up to about 73 again and the network was generating incoherent images again. After 24 hours straight the network was normalized and loss was about 20. The second phase lasted for about four days again, and the best checkpoint was at 16.80 loss.

Total training took 8 days but this is slightly unusual because I was trying to teach the network many things. Training the network to paint only portraits for example should only take about a day with two Nvidia V100 GPUs but with a single V100, 8 days is quite alright.

Pictures after the second phase. The pictures are painted with more intent now.

1 Like

Re: Generative Adversarial Networks ---- Training A Neural Network To Paint Art. by Enceladus(m): 2:23pm On Apr 24, 2021
Self Criticism Of the Network


One weakness of neural networks is that they are sensitive to training data, and they can be easily biased based on the data that was fed to them. I will give an example. Amazon once trained an AI to help in the recruitment process by rejecting or accepting candidates based on resume profile and it was later discovered that the AI was just rejecting women anyhow, even the qualified ones. The was later traced to the fact that it was not trained with enough women data so it was seeing them as some kind of aberration. My network too learnt some biasedness that I will talk about below.

1. Due to the abundant presence of their paintings in the dataset, the network will predominantly generate group portrait of the Masai Mara people of Kenya and Tanzania. Five in ten of these kinds of portraits belong to them.

2. The network has probably been brainwashed and believes in the term "THE FUTURE IS FEMALE" because it will hardly generate a male painting. I also noticed that it generates only afro hairstyle (?) for the females.

3. Any time the network generates a group abstract-like painting, expect the individuals to either carry a basket/calabash on their head or hold a cane for leading cows. (Fulanis una no try !!)

2 Likes

Re: Generative Adversarial Networks ---- Training A Neural Network To Paint Art. by Enceladus(m): 2:24pm On Apr 24, 2021
I will be trying to sell some of these paintings either as NFT or even try my luck at the many Lagos art exhibition events. Money must be made.

The network could do better, the loss could be lowered to about 1 - 2 but I don't have enough quality images in my dataset so I guess this will be the end of the project for now.

I will later create a Colab notebook and share the link here so that anyone interested can play with the network and generate some magic art for themselves.

Thanks for reading, Ad Astra.

1 Like

Re: Generative Adversarial Networks ---- Training A Neural Network To Paint Art. by islamics(m): 12:58pm On Sep 16, 2021
Nice effort op.
It was a nice read indeed.
Re: Generative Adversarial Networks ---- Training A Neural Network To Paint Art. by Genesiszero: 3:44pm On Sep 16, 2021
Good work..........
you did an enduring task by going through the image one by one!!!! kudos......

(1) (Reply)

Software (mobile App, Web App) Developers Needed For Full Time Employment / Front-end Project: Make-up School Website / Please How Can I Learn How To Work Remotely With Happen From Nigeria

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 25
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.