slothkong / dnn-pruning Goto Github PK
View Code? Open in Web Editor NEWThis project forked from franciszchen/dnn-pruning
A pyCaffe implementaion of the 2017 ICLR's "Pruning Filters for Efficient ConvNets" publication
This project forked from franciszchen/dnn-pruning
A pyCaffe implementaion of the 2017 ICLR's "Pruning Filters for Efficient ConvNets" publication
Vgg‘s prototxt and caffemodel was used to run this code , but it unfortunately occured this error--
Check failed: axis_index < num_axes() (1 vs. 1) axis 1 out of range for 1-D Blob with shape 100 (100)
you can tell you email?I have a problem ,want to talk with you? @slothkong
Hello! Thank you very much for your good implementation! Could you please tell me how can I download the weight file?
Filter Pruning
operating: conv = conv1 , convnext = res2a_branch1, bn = bn_conv1, dc = 32
Traceback (most recent call last):
File "filter_pruning_demo.py", line 748, in
prune_me = pruneLayer(prune_me, conv, convnext, bn, affine, dc)
File "filter_pruning_demo.py", line 139, in pruneLayer
net.WPQ[(conv_P,1)] = net.param_b_data(conv)
File "/home/cll/DNN-Pruning-master/lib/net.py", line 221, in param_b_data
return self.param_b(name).data
File "/home/cll/DNN-Pruning-master/lib/net.py", line 215, in param_b
return self.param(name)[1]
IndexError: Index out of range
hello,thanks for your code. but i have some problems in it.I let the entire network not pruning, let prune_mode = true ,but the re-saved model is only 10% accurate.
Ground-truth accuracy: top1 0.860 , top5 acc 0.987
Pruned model accuracy: (no fine-tune): top1 0.106 , top5 acc 0.525
this is my setting:
c.dcdic = {'conv1_1': 32,
'conv1_2': 64,
'conv2_1': 128,
'conv2_2': 128,
'conv3_1': 256,
'conv3_2': 256,
'conv3_3': 256,
'conv4_1': 512,
'conv4_2': 512,
'conv4_3': 512,
'conv5_1': 512,
'conv5_2': 512,
'conv5_3': 512}
please help me, thank for you.
The caffe report this error when I use this command:
python3 filter_pruning_demo.py -model ./temp/model.prototxt -weights ./temp/1.caffemodel
or
python3 filter_pruning_demo.py -model ./temp/model.prototxt
How to solve this problem?Thank you!
--- saveModel ---
in pt (new_pt): ./temp/renamed_model.prototxt
in model: ./temp/1.caffemodel
in WPQ: dict_keys([('conv4_1_P', 1), ('conv5_2_P', 1), 'conv3_1_scale_P', ('conv4_2_P', 1), 'conv3_2_bn_P', 'conv5_1_bn_P', 'conv5_1_scale_P', 'fc_P', 'conv4_3_bn_P', 'conv3_1_bn_P', ('conv5_1_P', 0), ('conv3_1_P', 1), 'conv4_2_scale_P', ('conv4_1_P', 0), 'conv5_3_scale_P', 'conv2_2_scale_P', ('conv4_2_P', 0), 'conv2_2_bn_P', 'conv2_1_scale_P', ('conv1_1_P', 0), ('conv3_1_P', 0), ('conv3_3_P', 1), 'conv4_1_scale_P', 'conv2_1_bn_P', ('conv3_2_P', 0), ('conv1_2_P', 0), ('conv2_2_P', 1), 'conv4_2_bn_P', ('conv2_2_P', 0), 'conv3_3_bn_P', 'conv1_1_bn_P', ('conv2_1_P', 0), ('conv5_3_P', 0), ('conv1_1_P', 1), ('conv4_3_P', 0), 'conv4_3_scale_P', ('conv3_3_P', 0), 'conv1_1_scale_P', ('conv1_2_P', 1), 'conv3_3_scale_P', 'conv1_2_scale_P', ('conv5_1_P', 1), 'conv3_2_scale_P', 'conv4_1_bn_P', ('conv5_2_P', 0), ('conv2_1_P', 1), 'conv5_2_scale_P', ('conv3_2_P', 1), ('conv4_3_P', 1), 'conv5_2_bn_P', 'conv5_3_bn_P', ('conv5_3_P', 1), 'conv1_2_bn_P'])
WARNING: Logging before InitGoogleLogging() is written to STDERR
F0419 17:33:12.103587 1048 blob.hpp:122] Check failed: axis_index < num_axes() (1 vs. 1) axis 1 out of range for 1-D Blob with shape 1 (1)
*** Check failure stack trace: ***
want to know if this work can be easily moved to the SSD model. Have you tried anything before?
Hi, @slothkong
I encountered some troubles when I try to prune filters for ResNet.
In the paper "Pruning Filters for Efficient ConvNets", the author has shown how to prune a residual block with a 1x1 conv projection shortcut, which is logical and reasonable; However, I cannot figure out how to efficiently prune a residual block without that 1x1 conv projection shortcut. It should note that most residual blocks in the ResNet have no 1x1 conv projection shortcut, i.e., their shortcuts contain no parameters. If we prune filters of both conv layers in such a residual block, the channels of the residual branch and the main branch might be different, and thus F(x) and the residual x cannot be added directly. I wonder how you slove this problem in your implemtation, and any suggestions/advices will be greatly appreciated!
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.