Skip to content

0jason000/DynamicQuant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
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.

About

The application of DynamicQuant based on MindSpore

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages