Accelerate Convolutional Neural Networks
This tool aims to accelerate the test-time computation and decrease number of parameters of deep CNNs.
How to use
accnn.py to get a new model by specifying an original model and the speeding-up ratio.
You may provide a json to explicitly control the architecture of the new model, otherwise the rank-selection algorithm would be used to do it automatically and the configuration would be saved to file
acc_fc.py would be involved automatically when using
acc_fc.py can also be used seperately.
###Speedup whole network
Speed up a model by 2 times and use
rank-selectionto determine ranks of each layer automatically
python accnn.py -m MODEL-PREFIX --save-model new-vgg16 --ratio 2
Use your own configuration file without
python accnn.py -m MODEL-PREFIX --save-model new-model --config YOUR-CONFIG_JSON
###Speedup a single layer
Decompose a convolutional layer:
python acc_conv.py -m MODEL-PREFIX --layer LAYER-NAME --K NUM-FILTER --save-model new-model
Decompose a fullyconnected layer:
python acc_fc.py -m MODEL-PREFIX --layer LAYER-NAME --K NUM-HIDDEN --save-model new-model
--helpto see more options
The experiments are carried on a single machine with four Nvidia Titan X GPUs. The top-5 accuracy is evaluated on ImageNet validation dataset.
|Model||Top-5 accuracy||Theoretical speed up||CPU speed up||GPU speed up|
model0is the original VGG16 model directly converted from Caffe Model Zoo
model1is the accelerated model based on
model2is the same as
model1but is fine-tuned on ImageNet training dataset for 5 epochs
model3is the accelerated model based on rank-selection with 3 times speeding up
model4is the same as
model3but is fine-tuned on ImageNet training dataset for 5 epochs
- The experiments in GPU are carried with cuDNN 4
This tool is verified on the VGG-16 model converted from Caffe by
accnn.pytool only supports single input and output
This tool mainly implements the algorithm of Cheng et al.  to decompose a convolutional layer to two convolutional layers both in spatial dimensions and across channels.
acc_conv.pyprovides the function to replace a
(N,d,d)conv. layer by two
The idea of
rank-selectiontool is based on the related work of Zhang et al  that we could use the product of PCA energy to determine the rank for each layer.
 Zhang, Xiangyu, et al. "Efficient and accurate approximations of nonlinear convolutional networks." arXiv preprint arXiv:1411.4229 (2014).
 Tai, Cheng, et al. "Convolutional neural networks with low-rank regularization." arXiv preprint arXiv:1511.06067 (2015).