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.
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);
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:
- Network in Network for CIFAR-10:
cifar_greedy_perforation
- AlexNet:
alexnet_greedy_perforation
- 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 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.