Git Product home page Git Product logo

facegan-generating-random-faces's Introduction

FaceGAN-Generating-Random-Faces

Generate Random Faces that do not exist. I trained a Deep Convolution GAN (DCGAN) on 100k celebrities photos.

Fork the notebook in Colab

Training Progress Web App view

Getting Started

Here I will explain how to train the FaceGAN, also how to set up the app running in your environment. Also, I will try to explain the basics of the Deep Convolutional Generative Adversarial Network.

Prerequisites

You will need Python 3.X.X with some packages which you can install directly using requirements.txt.

pip install -r requirements.txt

Get the Dataset

I have used the 100k celebrities dataset. You can download that dataset from this location Link.

Train the model (Get new weights for generator or train further)

Run the train_gan.py file. Using the following flags:

  • -w, --weights - saved weights directory
  • -p, --photo_dir - directory containing face images
  • -b, --batch_size - batch size
  • -e, --epochs - number of epochs to run
  • -i, --inp_dim - dimension of noise for generator

python3 train_gan.py --weights ./saved_weights -p ./photos -b 32 -e 10000 -i 100

Running the app

Use the following command in the app directory to run the app.

python3 app.py

DCGAN - Deep Convolutional Generative Adversarial Network

DCGAN is one of the popular and successful network design for GAN. It mainly composes convolution layers without max pooling or fully connected layers.

They are made of two distinct models, a generator and a discriminator. The job of the generator is to spawn ‘fake’ images that look like the training images. The job of the discriminator is to look at an image and output whether or not it is a real training image or a fake image from the generator. During training, the generator is constantly trying to outsmart the discriminator by generating better and better fakes, while the discriminator is working to become a better detective and correctly classify the real and fake images. The equilibrium of this game is when the generator is generating perfect fakes that look as if they came directly from the training data, and the discriminator is left to always guess at 50% confidence that the generator output is real or fake.

My Architecuture:

FaceGAN Architecture

Authors

Licence

This project is licensed under the MIT License - see the LICENSE.md file for details

Must Read

  1. Keep Calm and train a GAN. Pitfalls and Tips on training Generative Adversarial Networks
  2. How to set descrimator untrainable in GAN

facegan-generating-random-faces's People

Contributors

adityajn105 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

facegan-generating-random-faces's Issues

ValueError: axes don't match array

Hello i am getting this error : ValueError: axes don't match array

`
Traceback (most recent call last):
File "D:\work\FaceGAN-Generating-Random-Faces\train_gan.py", line 139, in
gan.load_weights(args.weights+'/gan_weights.h5')
File "C:\Users\dotsi\AppData\Local\Programs\Python\Python310\lib\site-packages\keras\utils\traceback_utils.py", line 67, in error_handler
raise e.with_traceback(filtered_tb) from None
File "<array_function internals>", line 180, in transpose
File "C:\Users\dotsi\AppData\Local\Programs\Python\Python310\lib\site-packages\numpy\core\fromnumeric.py", line 660, in transpose
return _wrapfunc(a, 'transpose', axes)
File "C:\Users\dotsi\AppData\Local\Programs\Python\Python310\lib\site-packages\numpy\core\fromnumeric.py", line 57, in _wrapfunc
return bound(*args, **kwds)
ValueError: axes don't match array

`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.