109 Star 874 Fork 1.5K

MindSpore/models

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

Dynamic Quantization Description

To conduct the low-bit quantization for each image individually, we develop a dynamic quantization scheme for exploring their optimal bit-widths. Experimental results show that our method can be easily embedded with mainstream quantization frameworks and boost their performance.

Paper:Zhenhua Liu, Yunhe Wang, Kai Han, Siwei Ma and Wen Gao. "Instance-Aware Dynamic Neural Network Quantization", CVPR 2022.

Model Architecture

A bit-controller is employed to generate the bit-width of each layer for different samples and the bit-controller is jointly optimized with the main network. You can find the details in the paper.

Dataset

Dataset used: ImageNet2012

  • Dataset size 224*224 colorful images in 1000 classes
    • Train: 1,281,167 images
    • Test: 50,000 images
  • Data format: jpeg
    • Note: Data will be processed in dataset.py

Environment Requirements

Script description

DynamicQuant
├── src
    └── dataset.py # dataset loader
    └── gumbelsoftmax.py # implementation of gumbel softmax
    └── quant.py # dynamic quantization
    └── resnet.py # resnet network
├── eval.py # inference entry
├── readme.md # Readme

Eval Process

Usage

After installing MindSpore via the official website, you can start evaluation as follows:

Launch

python eval.py --dataset_path [DATASET]

Result

result: {'acc': 0.6901} ckpt= ./resnet18_dq.ckpt

Checkpoint can be downloaded at https://download.mindspore.cn/model_zoo/research/cv/DynamicQuant/.

ModelZoo Homepage

Please check the official homepage.

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mindspore/models.git
git@gitee.com:mindspore/models.git
mindspore
models
models
master

搜索帮助