[GSoC] Add block quantized models (#270)
Browse files* Gemm and MatMul block quantization support
* refactoring
* fix indentation
* node name independent
* Block quantization tool:
- constant weight category supported
- add data type saturation
- handled the case in which all the elements within a block are the same
benchmark script modified to support block quantized models
block quantized some models
* add missing block quantized models
* formatting
* add blocked models to eval script. Evaluation yunet
* Add sface and pphumanseg evaluation, block quantization tool fix, handpose blocked model fix, removed blocked CRNN EN,
* changed evaluation metric in block_quantize script and add verbose mode
* Add evaluation for PP-ResNet and Mobilenet
* changed file suffix and update readmes
* renamed int8bq
README.md
CHANGED
@@ -4,14 +4,19 @@ Deep Residual Learning for Image Recognition
|
|
4 |
|
5 |
This model is ported from [PaddleHub](https://github.com/PaddlePaddle/PaddleHub) using [this script from OpenCV](https://github.com/opencv/opencv/blob/master/samples/dnn/dnn_model_runner/dnn_conversion/paddlepaddle/paddle_resnet50.py).
|
6 |
|
|
|
|
|
|
|
7 |
Results of accuracy evaluation with [tools/eval](../../tools/eval).
|
8 |
|
9 |
| Models | Top-1 Accuracy | Top-5 Accuracy |
|
10 |
| --------------- | -------------- | -------------- |
|
11 |
| PP-ResNet | 82.28 | 96.15 |
|
|
|
12 |
| PP-ResNet quant | 0.22 | 0.96 |
|
13 |
|
14 |
\*: 'quant' stands for 'quantized'.
|
|
|
15 |
|
16 |
## Demo
|
17 |
|
|
|
4 |
|
5 |
This model is ported from [PaddleHub](https://github.com/PaddlePaddle/PaddleHub) using [this script from OpenCV](https://github.com/opencv/opencv/blob/master/samples/dnn/dnn_model_runner/dnn_conversion/paddlepaddle/paddle_resnet50.py).
|
6 |
|
7 |
+
**Note**:
|
8 |
+
- `image_classification_ppresnet50_2022jan_int8bq.onnx` represents the block-quantized version in int8 precision and is generated using [block_quantize.py](../../tools/quantize/block_quantize.py) with `block_size=64`.
|
9 |
+
|
10 |
Results of accuracy evaluation with [tools/eval](../../tools/eval).
|
11 |
|
12 |
| Models | Top-1 Accuracy | Top-5 Accuracy |
|
13 |
| --------------- | -------------- | -------------- |
|
14 |
| PP-ResNet | 82.28 | 96.15 |
|
15 |
+
| PP-ResNet block | 82.27 | 96.15 |
|
16 |
| PP-ResNet quant | 0.22 | 0.96 |
|
17 |
|
18 |
\*: 'quant' stands for 'quantized'.
|
19 |
+
\*\*: 'block' stands for 'blockwise quantized'.
|
20 |
|
21 |
## Demo
|
22 |
|