tree: 537e0ff21c68951bf2a5f4aaeb2994d126892af2 [path history] [tgz]
  5. config.json

Accelerate Convolutional Neural Networks

This tool aims to accelerate the test-time computation and decrease number of parameters of deep CNNs.

How to use

Use 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 config.json. and would be involved automatically when using while and can also be used seperately.


###Speedup whole network

  • Speed up a model by 2 times and use rank-selection to determine ranks of each layer automatically

    python -m MODEL-PREFIX --save-model new-vgg16 --ratio 2
  • Use your own configuration file without rank-selection

    python -m MODEL-PREFIX --save-model new-model --config YOUR-CONFIG_JSON

###Speedup a single layer

  • Decompose a convolutional layer:

    python -m MODEL-PREFIX --layer LAYER-NAME --K NUM-FILTER --save-model new-model
  • Decompose a fullyconnected layer:

    python -m MODEL-PREFIX --layer LAYER-NAME --K NUM-HIDDEN --save-model new-model
  • uses --help to 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.

ModelTop-5 accuracyTheoretical speed upCPU speed upGPU speed up
  • model0 is the original VGG16 model directly converted from Caffe Model Zoo
  • model1 is the accelerated model based on config.json
  • model2 is the same as model1 but is fine-tuned on ImageNet training dataset for 5 epochs
  • model3 is the accelerated model based on rank-selection with 3 times speeding up
  • model4 is the same as model3 but 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 caffe_converter tool.

  • tool only supports single input and output

  • This tool mainly implements the algorithm of Cheng et al. [2] to decompose a convolutional layer to two convolutional layers both in spatial dimensions and across channels. provides the function to replace a (N,d,d) conv. layer by two (K,d,1) and (N,1,d) conv. layers.

  • The idea of rank-selection tool is based on the related work of Zhang et al [1] that we could use the product of PCA energy to determine the rank for each layer.

Reference Paper

[1] Zhang, Xiangyu, et al. “Efficient and accurate approximations of nonlinear convolutional networks.” arXiv preprint arXiv:1411.4229 (2014).

[2] Tai, Cheng, et al. “Convolutional neural networks with low-rank regularization.” arXiv preprint arXiv:1511.06067 (2015).