This repository provides a cnn channels pruning demo with tensorflow. You can pruning your own model(support conv2d,depthwise conv2d,pool,fc,concat, add ops and so on) defined in modelsets.py. Have a good time!
Tensorflow >= 1.10.0
python >= 3.5
opencv-python >= 4.1.0
numpy >= 1.14.5
matplotlib >= 3.0.3
$ git clone https://github.com/DasudaRunner/SimplePruning.git
Url: http://www.cs.toronto.edu/~kriz/cifar.html
You must use add_layer() API defined in pruner.py to set up your model. More details to modelsets.py
e.g. model name, learning rate, pruning rate.
$ python full_train.py
$ python channels_pruning.py
Model | Dataset | Pruning rate | Model size / MB | Inference time / ms*64pic |
---|---|---|---|---|
SimpleNet | cifar-10 | 0.5 | 8.7 -> 1.8 | 5.8 -> 2.7 |
VGG19 | cifar-10 | 0.5 | 53.4 -> 13.5 | 28.62 -> 9.44 |
DenseNet40 | cifar-10 | 0.5 | 4.3 -> 1.5 | 77.87 -> 39.97 |
MobileNet V1 | cifar-10 | 0.5 | 6.6 -> 1.8 | 19.39 -> 8.01 |
OCR-Net | --- | 0.5 | 2426.2 -> 841.9 | 10.36->7.3 |
Add
op.Concat
op.