/DCGAN-Face-Generator

Using Deep Convolutional Generative Adversarial Networks to generate new images of faces with PyTorch

Primary LanguageJupyter Notebook

DCGAN-Face-Generator

Using Generative Adversarial Networks to generate new images of faces with PyTorch.

Project Overview

This project is part of the requirements for the completion of the Udacity Deep Learning Nanodegree. It consists of building and training a DCGAN on the CelebA dataset to generate images of new and realistic human faces using PyTorch.

Project Result

Examples of faces generated with the model defined in the dlnd_face_generation_.ipynb :

DCGAN Face Generation Results

Project Instructions

Instructions

  1. Clone the repository and navigate to the downloaded folder.

    	git clone https://github.com/Saoussen-CH/DCGAN-Face-Generator.git
    	cd DCGAN-Face-Generator
    
  2. Download the CelebA dataset and unzip it in the notebook.

  3. Make sure you have already installed the necessary Python packages according to the Dependecies section of the README.

  4. Open a terminal window and navigate to the project folder. Open the notebook and follow the instructions.

    	jupyter notebook dlnd_face_generation_.ipynb
    

(Optionally) Accelerating the Training Process

If you decide to reproduce the code and it is taking too long to run, you will need to either reduce the complexity of your chosen CNN architecture or switch to running your code on a GPU. You can use Google Colab for free GPU.

Dependencies

1. Installation

Download Anaconda

Linux Mac Windows
64-bit 64-bit (bash installer) 64-bit (bash installer) 64-bit (exe installer)
32-bit 32-bit (bash installer) 32-bit (exe installer)

Install Anaconda on your machine. Detailed instructions:

2. Create and Activate the Environment

Please go though this doc before you creating an environment. After that create a environment using following command

conda create --name deep-learning

Then activate the environment using following command

activate deep-learning

Git and version control

These instructions also assume you have git installed for working with Github from a terminal window, but if you do not, you can download that first with the command:

conda install git

Now, you can create a local version of the project

  1. Clone the repository, and navigate to the downloaded folder. This may take a minute or two to clone due to the included image data.
git clone https://github.com/Saoussen-CH/DCGAN-Face-Generator.git
cd DCGAN-Face-Generator
  1. Install PyTorch and torchvision; this should install the latest version of PyTorch.

    • Linux or Mac:
    conda install pytorch torchvision -c pytorch 
    
    • Windows:
    conda install pytorch -c pytorch
    pip install torchvision
    
  2. Install a few required pip packages, which are specified in the requirements text file (including OpenCV).

pip install -r requirements.txt
  1. That's it!, Now run the project using following command, check you default browser and open dlnd_face_generation_.ipynb file
jupyter notebook