Giter Club home page Giter Club logo

metaqnn's Introduction

MetaQNN Codebase

MetaQNN is a codebase used for automatically designing convolutional neural network architectures outlined in the paper:

Designing Neural Network Architectures Using Reinforcement Learning
Bowen Baker, Otkrist Gupta, Nikhil Naik, Ramesh Raskar
International Conference on Learning Representations, 2017

If our software or paper helps your research or project, please cite us using:

@article{baker2017designing,
  title={Designing Neural Network Architectures using Reinforcement Learning},
  author={Baker, Bowen and Gupta, Otkrist and Naik, Nikhil and Raskar, Ramesh},
  journal={International Conference on Learning Representations},
  year={2017}
}

Installation

All code was only tested on ubuntu 16.04, python 2.7, with caffe at commit d208b71

  1. Install caffe using these instructions with CUDA 8 and cuDNN 5.1.
  2. pip install -r requirements.txt

Quick Example (CIFAR-10)

  1. Create CIFAR-10 LMDB's on each server you plan to use for training

    python libs/input_modules/lmdb_creator.py cifar10 /path/to/data/directory/cifar10 -gcn True -v 5000
  2. Modify models/cifar10/hyper_parameters.py
    2a. set TRAIN_FILE = '/path/to/data/directory/cifar10/train.lmdb'
    2b. set VAL_FILE = '/path/to/data/directory/cifar10/val.lmdb'
    2c. set CAFFE_ROOT = '/path/to/caffe/installation/directory'
    2d. (optional) set CHECKPOINT_DIR = '/path/to/model/snapshot/directory/'

  3. Create directory cifar10_logs to store Q-values and replay database

  4. Start Q-Learning Server

    python q_server.py cifar10 cifar10_logs
  5. On each server you want to use for training start a Q-Learning Client

    python caffe_client.py cifar10 unique_client_identifier server_ip_addr

    If you want to use a specific gpu, for example GPU 4

    python caffe_client.py cifar10 unique_client_identifier server_ip_addr -gpu 4

    If you are using a multi-gpu server and want to run 4 clients that use GPUs 0 1 3 5 (This command requires you to have tmux installed)

    ./caffe_multiclient.sh cifar10 unique_client_identifier server_ip_addr 0 1 3 5

MetaQNN Code Description

Experiment configurations are stored in the models folder. Each experiment contains a hyper_parameters.py file that contains optimization hyperparameters, data paths, etc., and a state_space_parameters.py file that contains state space specifications. The sample experiments are densely commented so that you may easily change around the experiment configurations.

We implemented the Q-Learning algorithm in a distributed server-client framework. One server runs the Q-Learning algorithm and sends out jobs to train CNNs on client servers. We currently only have published a client that uses Caffe for CNN training. If there is enough interest I will publish a client that uses MXNet as well.

Dataset Creation

We provide easy-to-use helper functions to download and preprocess the CIFAR-10, CIFAR-100, MNIST, and SVHN datasets. It supports standard whitening, local contrast normalization, global contrast normalization, mean subtraction, and padding. The module will save both training and validation lmdbs as well as the full training set and test set lmdbs to the specified location. To see all options run

python libs/input_modules/lmdb_creator.py -h

Examples

  1. Create CIFAR-10 dataset with global contrast normalization and 5000 validation images run

    python libs/input_modules/lmdb_creator.py cifar10 /path/to/data/directory/cifar10 -gcn True -v 5000
  2. Create MNIST dataset with mean subtraction and 10000 validation images

    python libs/input_modules/lmdb_creator.py mnist /path/to/data/directory/mnist -ms True -v 10000
  3. Create the SVHN dataset with the extra 531131 training images and local contrast normalization and standard validation set

    python libs/input_modules/lmdb_creator.py svhn_full /path/to/data/directory/svhn_full -prep lcn 
  4. Create the 10% SVHN dataset with standard whitening

    python libs/input_modules/lmdb_creator.py svhn_small /path/to/data/directory/svhn -prep standard_whiten

Speeding Up Meta-Modeling with Performance Prediction

If you have limited hardware or just want to run through a larger number of networks, we highly recommend implementing early stopping with simple performance prediction models as outlined in our recent paper

Practical Neural Network Performance Prediction for Early Stopping
Bowen Baker*, Otkrist Gupta*, Nikhil Naik, Ramesh Raskar
Under Submission

We will be releasing code for this before the end of the summer, but the method is extremely simple so you shouldn't have any trouble implementing it yourself if you need to use it before our release.

metaqnn's People

Contributors

bowenbaker avatar peterldowns avatar

Watchers

James Cloos 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.