Code Monkey home page Code Monkey logo

dlnd-dcgan-face-generation's Introduction

dlnd-DCGAN-Face-Generation

This repo trains a Deep Convolutional Generative Adversarial Network (DCGAN) to generate faces. The motivation for this program was the 4th project in the Udacity Deep Learning Nanodegree.

How to run on AWS

This project can be executed directly from within the dlnd_face_generation.ipynd Jupyter notebook. Due to the time required to train the model, it is recommended that a GPU is used. The output shown in the report and notebook were generated on AWS' Deep Learning AMI (Ubuntu 18.04) Version 26.0 with a p2.xlarge instance.

  1. Launch your AWS instance and ssh into it.

    • Remember to add a "Custom TCP Rule" to your security group inbound rules to allow Jupyter notebooks.

    From AWS CLI

  2. Configure Jupyter notebook

    jupyter notebook --generate-config
    sed -ie "s/#c.NotebookApp.ip = 'localhost'/#c.NotebookApp.ip = '*'/g" ~/.jupyter/jupyter_notebook_config.py
  3. Clone the repo.

    git clone https://github.com/daniel-fudge/dlnd-DCGAN-Face-Generation.git
  4. Download the input files (you can replaces with your own files) and unzip.

    cd dlnd-DCGAN-Face-Generation
    wget https://s3.amazonaws.com/video.udacity-data.com/topher/2018/November/5be7eb6f_processed-celeba-small/processed-celeba-small.zip
    unzip processed-celeba-small.zip
    rm *.zip
    rm -r __MACOSX
  5. Activate Python 3 environment with PyTorch, CUDA 10 and MKL-DNN. Then install cv2.

    source activate pytorch_p36
    conda install opencv
  6. Start Jupyter notebook

    jupyter notebook --ip=0.0.0.0 --no-browser
  7. Record the long URL generated by the previous command, it should have the format http://[some_ip]:8888/?token=[your_token].

    From your local PC

  8. Connect to the notebook from your browser by replacing [some_ip] with your instances IPv4 Public IP.

  9. Open dlnd_face_generation.ipynb.

  10. Read and/or run the cells at your leisure!! :)

How to run on Local PC

Although it is not recommended to train on a local PC, you may want to run locally to debug.

  1. Clone repo to PC.

    git clone https://github.com/daniel-fudge/dlnd-DCGAN-Face-Generation.git
  2. Download processed-celeba-small.zip and unzip into dlnd-DCGAN-Face-Generation folder.

  3. [OPTIONAL] Delete the zip file and any miscellaneous OS X files or folders such as __MACOSX or .DS_Store.

  4. [OPTIONAL] Install Anaconda3.

  5. [OPTIONAL] Create a virtual environment.

    conda update conda
    conda create -n pytorch_p36 python=3.7 
    conda activate pytorch_p36
    conda install pytorch
    conda install -c pytorch torchvision
    conda install opencv
    conda install matplotlib
    conda install tqdm
  6. [OPTIONAL] Activate the virtual environment.

    conda activate pytorch_p36
  7. Launch Jupyter.

    cd dlnd-DCGAN-Face-Generation
    jupyter notebook
  8. Open dlnd_face_generation.ipynb.

  9. Read and/or run the cells at your leisure!! :)

Report

A report was generated from the Jupyter Notebook for those who prefer html files.

License

This code is copyright under the MIT License.

Contributions

Please feel free to raise issues against this repo if you have any questions or suggestions for improvement.

dlnd-dcgan-face-generation's People

Contributors

daniel-fudge avatar

Watchers

 avatar  avatar

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.