- Contents
- Dynamic Quantization Description
- Model Architecture
- Dataset
- Environment Requirements
- Script Description
- Eval Process
- ModelZoo Homepage
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.
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 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
- Hardware(Ascend/GPU/CPU)
- Prepare hardware environment with Ascend/GPU/CPU processor.
- Framework
- For more information, please check the resources below:
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
After installing MindSpore via the official website, you can start evaluation as follows:
python eval.py --dataset_path [DATASET]
result: {'acc': 0.6901} ckpt= ./resnet18_dq.ckpt
Checkpoint can be downloaded at https://download.mindspore.cn/model_zoo/research/cv/DynamicQuant/.
Please check the official homepage.