/Face-Gan

First attempt with generative adversarial networks!

Primary LanguageJupyter Notebook

Face-Gan

First attempt with generative adversarial networks!

⚠️ COMMENT ⚠️ these lines in GAN1 notebook if you intend to run it for the firs time!
generator = load_model(os.path.join('models','face_generator.h5'))
discriminator = load_model(os.path.join('models','face_discriminator.h5')) these lines are made to train the model in different sessions

I've been having some fun with open-source Kaggle dataset recently. You can find it here: https://www.kaggle.com/datasets/jonathanoheix/face-expression-recognition-dataset
some examples:
33 4 1907 317 1112 2787 9366 34

Although the dataset is ""small"" a gan still made some decent results! Not photorealistic but more like 'WWI black and white' style.

I'm testing different generative architectures, one using keras layer UpSampling2d() and another one using Conv2DTranspose().

Here's the difference:

GAN 1 (Upsapling2D):

Initial Random Input: upsampling

training progress:
1000 epochs:
generated_img_1_0 generated_img_122_1 generated_img_280_1 generated_img_332_1 generated_img_7_0

many more epochs: (best results)
generated_img_200_1 generated_img_94_1 generated_img_24_1 generated_img_88_2 generated_img_58_2 generated_img_52_0 generated_img_5_0a generated_img_11_0a a generated_img_76_0 gena generated_img_10_0

GAN 2 (Conv2DTranspose):

Initial Random Input: transpose

100 epochs:
generated_img_98_0 generated_img_7_0 generated_img_2_0

1000 epochs:
generated_img_32_0 generated_img_21_0 generated_img_61_0

many more epochs:
generated_img_19_0 generated_img_93_0 generated_img_94_0

OBSERVATIONS

  • both GANSs don't seem to be able to converge even after days of training. This may be due to the size of the dataset
  • gan 1 permorms overall better

TO DO LIST

3/10/2022 UPDATE

After having tried with a different dataset (30 k faces from FFHQ dataset) mentioned above the imporvements were astonishing. I'm happy to share some results below.

generated_img_43_1 generated_img_45_2 generated_img_47_0 generated_img_48_2 generated_img_13_1 generated_img_15_0 generated_img_22_2 generated_img_44_1


some more training...
generated_img_49_1 generated_img_56_1 generated_img_68_0 generated_img_14_0 generated_img_69_0 generated_img_66_2