Code Monkey home page Code Monkey logo

magic_init's Introduction

Data-dependent initialization of convolutional neural networks

Created by Philipp Krähenbühl.

Introduction

This code implements the initialization presented in our arXiv tech report, which is under submission at ICLR 2016.

This is a reimplementation and currently work in progress. Use at your own risk.

License

This code is released under the BSD License (refer to the LICENSE file for details).

Citing

If you find our initialization useful in your research, please consider citing:

@article{krahenbuhl2015data,
  title={Data-dependent Initializations of Convolutional Neural Networks},
  author={Kr{\"a}henb{\"u}hl, Philipp and Doersch, Carl and Donahue, Jeff and Darrell, Trevor},
  journal={arXiv preprint arXiv:1511.06856},
  year={2015}
}

Setup

Checkout the project and create a symlink to caffe in the magic_init directory:

ln -s path/to/caffe/python/caffe caffe

Examples

Here is a quick example on how to initialize alexnet:

python magic_init.py path/to/alexnet/deploy.prototxt path/to/output.caffemodel -d "path/to/some/images/*.png" -q -nit 10 -cs

Here -d flag allows you to initialize the network using your own images. Feel free to use imagenet, Pascal, COCO or whatever you have at hand, it shouldn't make a big difference. The -q (queit) flag suppresses all the caffe logging, -nit controls the number of batches used (while -bs controls the batch size). Finally -cs rescales the gradients accross layers. This rescaling currently works best for feed-forward networks, and might not work too well for DAG structured networks (we are working on that).

To run the k-means initialization use:

python magic_init.py path/to/alexnet/deploy.prototxt path/to/output.caffemodel -d "path/to/some/images/*.png" -q -nit 10 -cs -t kmeans

Finally, python magic_init.py -h should provide you with more help.

Pro tips

If you're numpy implementation is based on openblas, try disabeling threading export OPENBLAS_NUM_THREADS=1, it can improve the runtime performance a bit.

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.