基于Caffe-Int8-Convert-Tools进行caffe模型转int8量化

参考文章:https://blog.csdn.net/u014644466/article/details/83278954

准备:
(1)测试网络的prototxt文件
(2)训练生成的caffemodel文件
(3)验证集图像文件
(4)工具下载:git clone https://github.com/lyk125/caffe-int8-convert-tools.git

ncnn官网推荐工具:https://github.com/BUG1989/caffe-int8-convert-tools
(5)caffe深度学习框架

模型转换:

1、输入为三通道模型:不用预处理

2、转换工具生成table文件:

注意:转换前,一定要将模型更新成最新模型。而且要严格按照如下步骤:

https://blog.csdn.net/weixin_41770169/article/details/86543010

$ ~/caffe/build/tools/upgrade_net_proto_text mobilenet_deploy.prototxt mobilenet_deploy_new.prototxt
$ ~/caffe/build/tools/upgrade_net_proto_binary mobilenet.caffemodel mobilenet_new.caffemodel

table文件转换:

python caffe-int8-convert-tool.py --proto=mobilenet_deploy_new.prototxt --model=mobilenet_new.caffemodel --mean 104 117 123 --images=ILSVRC2012_1k --output=mobilenet_new.table --gpu=1

 

3、caffe2ncnn转换

./caffe2ncnn mobilenet_deploy_new.prototxt mobilenet_new.caffemodel mobilenet_new.param mobilenet_new.bin 256 mobilenet_new.table

我这里原模型大小44M,压缩后11M。

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值