Skip to content

This is example code on how to train Binary Neural Networks that fit on the BinarEye chip

License

Notifications You must be signed in to change notification settings

BertMoons/BinarEye

Repository files navigation

BinarEye training code

This code is not fully cleaned-up yet, porting might not be trivial yet. Expect regular updates to improve upon this.

Introduction

Train your own Binary Neural Networks (BNN) - networks trained with 1b weights and activations - in Theano / Lasagne. This code was used to train Binary Neural Networks, specifically for the BinarEye chip (reference coming up).

This code uses / is based on the lasagne/theano version of BinaryNet.

Preliminaries

Running this code requires:

  1. Theano
  2. Lasagne
  3. A GPU with recent versions of CUDA and CUDNN
  4. pylearn2 for MNIST, SVHN and CIFAR-10
  5. The custom datasets for facedetection, ownerrecognition, anglerecognition and 10-face facerecognition can be found here:

Training your own BNN

Once you have all data sets local, you can run the following commands to start training:

  • cd ./CIFAR10/; python cifar10.py -f 256
  • cd ./MNIST/; python mnist.py -f 256
  • cd ./SVHN/; python svhn.py -f 256
  • cd ./train_anglerecognition_custom/; python AngleSense.py -f 256
  • cd ./train_facedetection_custom/; python AngleSense.py -f 256
  • cd ./train_facerecognition_custom/; python AngleSense.py -f 256
  • cd ./train_ownerrecognition_custom/; python AngleSense.py -f 256

Where f is the number of filters in every layer (the width of every layer in the network). In BinarEye, f is constrained to either 64, 128 or 256.

References and acknowledgements

The used datasets are built on existing datasets.

  1. facedetection, ownerdetection and facerecognition are built on a combination of mini-crops of backgrounds from Stanford and faces from LFW
  2. anglerecognition is built on cropped and aligned faces from AdienceFaces

All input images are rescaled to 32x32x3 input images in order to be processed by the BinarEye chip. Backgrounds are either 32x32 crops of larger images, or 32x32 rescales of larger sub-images.

About

This is example code on how to train Binary Neural Networks that fit on the BinarEye chip

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages