yuzhe630 / perforated-cnn-matconvnet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

perforated-cnn-matconvnet

PerforatedCNNs accelerate convolutional neural networks (CNNs) by skipping evaluation of the convolutional layers in some of the spatial positions. See the paper for more details:

Michael Figurnov, Aijan Ibraimova, Dmitry Vetrov, Pushmeet Kohli. PerforatedCNNs: Acceleration through Elimination of Redundant Convolutions. NIPS 2016 [arXiv].

The code is based on MatConvNet from December 2014, with some backports (such as more aggressive memory savings for ReLU).

See also Caffe implementation of PerforatedCNNs.

Installation

Clone the repository, run MATLAB, go to acceleration directory. Compile the code:

setup;
vl_compilenn('enableGpu', true, 'enableImReadJpeg', true);

Run some tests:

vl_test_nnconv_perf(0); vl_test_nnconv_perf(1);
vl_test_nnpool_fast(0); vl_test_nnpool_fast(1);

Experiment: perforation of whole network

See sections 3.3 and 4.3 of the paper for details.

Download .mat files with network weights and CIFAR-10 dataset from here. Put them into the root folder. Navigate into acceleration directory. There is a script per network:

  1. Network in Network for CIFAR-10: cifar_greedy_perforation
  2. AlexNet: alexnet_greedy_perforation
  3. VGG-16: vgg_greedy_perforation

Set dataDir path in the AlexNet and VGG-16 scripts if you want to build perforated networks for ImageNet. Change the useGpuTimings setting to select the target device for a perforated network (CPU or GPU). Example:

setup;
cifar_greedy_perforation('useGpuTimings', true);

MatConvNet's original README

MatConvNet is a MATLAB toolbox implementing Convolutional Neural Networks (CNNs) for computer vision applications. It is simple, efficient, and can run and learn state-of-the-art CNNs. Several example CNNs are included to classify and encode images. Please visit the homepage to know more.

About

License:Other


Languages

Language:MATLAB 35.1%Language:Cuda 31.5%Language:C++ 15.4%Language:C 9.9%Language:Python 3.7%Language:Shell 3.3%Language:Makefile 1.2%