【Google量化】Mobilenet TensorFlow-Slim

本文介绍了Google 2018年的CVPR论文,探讨了用于高效整数算术仅推断的神经网络量化技术。文章详细讲解了CNN量化,特别是针对MobileNet V1的实现,包括训练过程、模型转换和量化工具的使用,以实现更高效的设备端推理。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

最近在做量化相关的工作,在老师的推荐下看了这篇文章,这篇文章是google2018新的作品,非常良心,讲解非常详细,而且有代码可以work。

一、参考文献

Quantization and Training of Neural Networks for Efficient Integer-Arithmetic-Only Inference

The rising popularity of intelligent mobile devices and the daunting computational cost of deep learning-based models call for efficient and accurate on-device inference schemes. We propose a quantization scheme that allows inference to be carried out using integer-only arithmetic, which can be implemented more efficiently than floating point inference on commonly available integer-only hardware. We also co-design a training procedure to preserve end-to-end model accuracy post quantization. As a result, the proposed quantization scheme improves the tradeoff between accuracy and on-device latency. The improvements are significant even on MobileNets, a model family known for run-time efficiency, and are demonstrated in ImageNet classification and COCO detection on popular CPUs.

文章讲解:

Google CVPR 2018论文:CNN量化技术

Additionally, the minimum and maximum values for activations are determined during training. This allows a model trained with quantization in the loop to be converted to a fixed point inference model with little effort, eliminating the need for a separate calibration step.

此外,激活的最小值和最大值在训练期间确定。这使得在循环中用量化训练的模型可以毫不费力地转换成固定点推断模型,从而不需要单独的校准步骤。(校准是为了获得参数的范围)


二、具体实现

github 代码:

https://github.com/tensorflow/models/blob/master/research/slim/nets/mobilenet_v1.md

The linked model tar files contain the following:

  • Trained model checkpoints:

mobilenet_v1_1.0_224.ckpt.data-00000-of-00001(保存变量及其取值)

mobilenet_v1_1.0_224.ckpt.index

mobilenet_v1_1.0_224.ckpt.meta(保存图结构)

  • Eval graph text protos (to be easily viewed) :mobilenet_v1_1.0_224_eval.pbtxt
  • Frozen trained models:mobilenet_v1_1.0_224_frozen.pb(模型大小:17173742
  • Info file containing input and output information:mobilenet_v1_1.0_224_info.txt
  • Converted TensorFlow Lite flatbuffer model:mobilenet_v1_1.0_224.tflite(模型大小:4276000

Note that

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值