Tencent / PocketFlow

An Automatic Model Compression (AutoMC) framework for developing smaller and faster AI applications.
https://pocketflow.github.io
Other
2.79k stars 490 forks source link

dcp压缩后,模型大小不变 #305

Open huoguangdiandian opened 5 years ago

huoguangdiandian commented 5 years ago

您好,我无论在resnet还是mobilenet上,利用dcp通道剪枝后,模型大小始终不变,即使转成.pb文件也不变,但是模型测试相比原来有变化,请问这是什么原因呢

yuanyuanli85 commented 5 years ago

This is because the channel not really pruned in dcp,instead those channels are masked. So, no reduction in model size

来自GitHub小程序客户端:

image

huoguangdiandian commented 5 years ago

请问如果被屏蔽的通道没有去除会影响推理速度吗?能把那些屏蔽的通道能去除吗?

huoguangdiandian commented 5 years ago

前提是我没有用框架里的程序转为.pb文件

huoguangdiandian commented 5 years ago

This is because the channel not really pruned in dcp,instead those channels are masked. So, no reduction in model size

来自GitHub小程序客户端:

image

请问能得到压缩后的模型吗?

yuanyuanli85 commented 5 years ago

可以获得压缩后的模型,但是需要稍复杂一点的操作,尤其对于有residual block的网络结构来说,比如resnet50. 你需要确保residual block中add的两个conv的pruned 通道一致,否则会出现错误。

huoguangdiandian commented 5 years ago

PocketFlow框架里给出的例子,比如resnet18、lenet对于cifar10数据集训练模型,都能够直接得到压缩后的模型,而且模型大小也能根据剪枝通道比例获得,并没有经过复杂的操作,能解释一下吗?我现在用的网络是resnet18、50和mobilenetv1、v2,训练数据是从imagenet中随机挑选40类,非常感谢。。。