Skip to content

Commit 9184926

Browse files
authored
add int8 efficientnet, inceptionv1, ssdmbv1, ssd, fcn_rn50 (#495)
* add int8 efficientnet, inceptionv1, ssdmbv1, ssd, fcn_rn50 Signed-off-by: mengniwa <[email protected]> * fix model path Signed-off-by: mengniwa <[email protected]>
1 parent 6ab957a commit 9184926

23 files changed

+263
-27
lines changed

vision/classification/efficientnet-lite4/README.md

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,19 @@ EfficientNet-Lite 4 is the largest variant and most accurate of the set of Effic
1010

1111
## Model
1212

13-
|Model |Download | Download (with sample test data)|ONNX version|Opset version|
14-
|-------------|:--------------|:--------------|:--------------|:--------------|
15-
|EfficientNet-Lite4 | [51.9 MB](model/efficientnet-lite4-11.onnx) | [48.6 MB](model/efficientnet-lite4-11.tar.gz)|1.7.0|11|
16-
13+
|Model |Download | Download (with sample test data)|ONNX version|Opset version|Top-1 accuracy (%)|
14+
|-------------|:--------------|:--------------|:--------------|:--------------|:--------------|
15+
|EfficientNet-Lite4 | [51.9 MB](model/efficientnet-lite4-11.onnx) | [48.6 MB](model/efficientnet-lite4-11.tar.gz)|1.7.0|11|80.4|
16+
|EfficientNet-Lite4-int8 | [13.0 MB](model/efficientnet-lite4-11-int8.onnx) | [12.2 MB](model/efficientnet-lite4-11-int8.tar.gz)|1.9.0|11|77.56|
17+
> The fp32 Top-1 accuracy got by [Intel® Neural Compressor](https://github.com/intel/neural-compressor) is 77.70%, and compared with this value, int8 EfficientNet-Lite4's Top-1 accuracy drop ratio is 0.18% and performance improvement is 1.12x.
18+
>
19+
> **Note**
20+
>
21+
> The performance depends on the test hardware. Performance data here is collected with Intel® Xeon® Platinum 8280 Processor, 1s 4c per instance, CentOS Linux 8.3, data batch size is 1.
1722
1823
### Source
1924
Tensorflow EfficientNet-Lite4 => ONNX EfficientNet-Lite4
25+
ONNX EfficientNet-Lite4 => Quantized ONNX EfficientNet-Lite4
2026

2127
<hr>
2228

@@ -132,14 +138,43 @@ The model was trained using [COCO 2017 Train Images, Val Images, and Train/Val a
132138
Refer to [efficientnet-lite4 conversion notebook](https://github.com/onnx/tensorflow-onnx/blob/master/tutorials/efficientnet-lite.ipynb) for details of how to use it and reproduce accuracy.
133139
<hr>
134140

141+
## Quantization
142+
CaffeNet-int8 is obtained by quantizing fp32 CaffeNet model. We use [Intel® Neural Compressor](https://github.com/intel/neural-compressor) with onnxruntime backend to perform quantization. View the [instructions](https://github.com/intel/neural-compressor/blob/master/examples/onnxrt/image_recognition/onnx_model_zoo/efficientnet/quantization/ptq/README.md) to understand how to use Intel® Neural Compressor for quantization.
143+
144+
### Environment
145+
onnx: 1.9.0
146+
onnxruntime: 1.8.0
147+
148+
### Prepare model
149+
```shell
150+
wget https://github.com/onnx/models/raw/master/vision/classification/efficientnet-lite4/model/efficientnet-lite4-11.onnx
151+
```
152+
153+
### Model quantize
154+
Make sure to specify the appropriate dataset path in the configuration file.
155+
```bash
156+
bash run_tuning.sh --input_model=path/to/model \ # model path as *.onnx
157+
--config=efficientnet.yaml \
158+
--output_model=path/to/save
159+
```
160+
<hr>
161+
135162
## References
136-
Tensorflow to Onnx conversion [tutorial](https://github.com/onnx/tensorflow-onnx/blob/master/tutorials/efficientnet-lite.ipynb). The Juypter Notebook references how to run an evaluation on the efficientnet-lite4 model and export it as a saved model. It also details how to convert the tensorflow model into onnx, and how to run its preprocessing and postprocessing code for the inputs and outputs.
163+
* Tensorflow to Onnx conversion [tutorial](https://github.com/onnx/tensorflow-onnx/blob/master/tutorials/efficientnet-lite.ipynb). The Juypter Notebook references how to run an evaluation on the efficientnet-lite4 model and export it as a saved model. It also details how to convert the tensorflow model into onnx, and how to run its preprocessing and postprocessing code for the inputs and outputs.
164+
165+
* Refer to this [paper](https://arxiv.org/abs/1905.11946) for more details on the model.
166+
167+
* [Intel® Neural Compressor](https://github.com/intel/neural-compressor)
137168

138-
Refer to this [paper](https://arxiv.org/abs/1905.11946) for more details on the model.
139169
<hr>
140170

141171
## Contributors
142-
[Shirley Su](https://github.com/shirleysu8)
172+
* [Shirley Su](https://github.com/shirleysu8)
173+
* [mengniwang95](https://github.com/mengniwang95) (Intel)
174+
* [airMeng](https://github.com/airMeng) (Intel)
175+
* [ftian1](https://github.com/ftian1) (Intel)
176+
* [hshen14](https://github.com/hshen14) (Intel)
177+
143178
<hr>
144179

145180
## License
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:2b3cbb5077262b20df565dacddecb3724c0976c35029a87e512d13aa4eff04a2
3+
size 13585963
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:3b03546fb343ba48e3243c893ea37e47cb1f337d80ed0aca562077d8d3da51b6
3+
size 12780764

vision/classification/inception_and_googlenet/inception_v1/README.md

Lines changed: 50 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,31 @@
22

33
# Inception v1
44

5-
|Model |Download |Download (with sample test data)| ONNX version |Opset version|
6-
| ------------- | ------------- | ------------- | ------------- | ------------- |
7-
|Inception-1| [28 MB](model/inception-v1-3.onnx) | [29 MB](model/inception-v1-3.tar.gz) | 1.1 | 3|
8-
|Inception-1| [28 MB](model/inception-v1-6.onnx) | [29 MB](model/inception-v1-6.tar.gz) | 1.1.2 | 6|
9-
|Inception-1| [28 MB](model/inception-v1-7.onnx) | [29 MB](model/inception-v1-7.tar.gz) | 1.2 | 7|
10-
|Inception-1| [28 MB](model/inception-v1-8.onnx) | [29 MB](model/inception-v1-8.tar.gz) | 1.3 | 8|
11-
|Inception-1| [28 MB](model/inception-v1-9.onnx) | [29 MB](model/inception-v1-9.tar.gz) | 1.4 | 9|
5+
|Model |Download |Download (with sample test data)| ONNX version |Opset version| Top-1 accuracy (%)|
6+
| ------------- | ------------- | ------------- | ------------- | ------------- |------------- |
7+
|Inception-1| [28 MB](model/inception-v1-3.onnx) | [29 MB](model/inception-v1-3.tar.gz) | 1.1 | 3| |
8+
|Inception-1| [28 MB](model/inception-v1-6.onnx) | [29 MB](model/inception-v1-6.tar.gz) | 1.1.2 | 6| |
9+
|Inception-1| [28 MB](model/inception-v1-7.onnx) | [29 MB](model/inception-v1-7.tar.gz) | 1.2 | 7| |
10+
|Inception-1| [28 MB](model/inception-v1-8.onnx) | [29 MB](model/inception-v1-8.tar.gz) | 1.3 | 8| |
11+
|Inception-1| [28 MB](model/inception-v1-9.onnx) | [29 MB](model/inception-v1-9.tar.gz) | 1.4 | 9| |
12+
|Inception-1| [27 MB](model/inception-v1-12.onnx) | [25 MB](model/inception-v1-12.tar.gz) | 1.9 | 12| 67.23|
13+
|Inception-1-int8| [10 MB](model/inception-v1-12-int8.onnx) | [9 MB](model/inception-v1-12-int8.tar.gz) | 1.9 | 12| 67.24|
14+
> Compared with the fp32 Inception-1, int8 Inception-1's Top-1 accuracy drop ratio is -0.01% and performance improvement is 1.26x.
15+
>
16+
> **Note**
17+
>
18+
> The performance depends on the test hardware. Performance data here is collected with Intel® Xeon® Platinum 8280 Processor, 1s 4c per instance, CentOS Linux 8.3, data batch size is 1.
19+
1220

1321
## Description
1422
Inception v1 is a reproduction of GoogLeNet.
1523

16-
### Paper
17-
[Going deeper with convolutions](https://arxiv.org/abs/1409.4842)
18-
1924
### Dataset
2025
[ILSVRC2012](http://www.image-net.org/challenges/LSVRC/2012/)
2126

2227
## Source
2328
Caffe2 Inception v1 ==> ONNX Inception v1
29+
ONNX Inception v1 ==> Quantized ONNX Inception v1
2430

2531
## Model input and output
2632
### Input
@@ -44,5 +50,39 @@ random generated sampe test data:
4450

4551
## Results/accuracy on test set
4652

53+
## Quantization
54+
Inception-1-int8 is obtained by quantizing fp32 Inception-1 model. We use [Intel® Neural Compressor](https://github.com/intel/neural-compressor) with onnxruntime backend to perform quantization. View the [instructions](https://github.com/intel/neural-compressor/blob/master/examples/onnxrt/image_recognition/onnx_model_zoo/inception/quantization/ptq/README.md) to understand how to use Intel® Neural Compressor for quantization.
55+
56+
### Environment
57+
onnx: 1.9.0
58+
onnxruntime: 1.8.0
59+
60+
### Prepare model
61+
```shell
62+
wget https://github.com/onnx/models/blob/master/vision/classification/inception_and_googlenet/inception_v1/model/inception-v1-12.onnx
63+
```
64+
65+
### Model quantize
66+
Make sure to specify the appropriate dataset path in the configuration file.
67+
```bash
68+
bash run_tuning.sh --input_model=path/to/model \ # model path as *.onnx
69+
--config=inception_v1.yaml \
70+
--data_path=/path/to/imagenet \
71+
--label_path=/path/to/imagenet/label \
72+
--output_model=path/to/save
73+
```
74+
75+
## References
76+
* [Going deeper with convolutions](https://arxiv.org/abs/1409.4842)
77+
78+
* [Intel® Neural Compressor](https://github.com/intel/neural-compressor)
79+
80+
81+
## Contributors
82+
* [mengniwang95](https://github.com/mengniwang95) (Intel)
83+
* [airMeng](https://github.com/airMeng) (Intel)
84+
* [ftian1](https://github.com/ftian1) (Intel)
85+
* [hshen14](https://github.com/hshen14) (Intel)
86+
4787
## License
4888
MIT
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:7d25f0bfa7a92e9a67d8049facd4454911ca4388a303fc61ee14664b1010c717
3+
size 10191535
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:296e49e0f1253877053d5aa48f4192f675b302b5828e70a821d6d94e0c8ee4e3
3+
size 9463738
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:814b31a6316873bd03d2d808415ce1f40a7bf48ad88eab5ecc3cdc8dc6cf38ec
3+
size 28021958
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:c4198ed3415d59dacab2f6fa90c81f1a3aa9f3623b66e2d9653f16d06a5cc68c
3+
size 26545542

vision/object_detection_segmentation/fcn/README.md

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,14 @@ This specific model detects 20 different [classes](dependencies/voc_classes.txt)
1313
|----------------|:--------------------------------------|:----------------------------------------|:-------------|:--------------|:--------|
1414
| FCN ResNet-50 | [134 MB](model/fcn-resnet50-11.onnx) | [213 MB](model/fcn-resnet50-11.tar.gz) | 1.8.0 | 11 | 60.5% |
1515
| FCN ResNet-101 | [207 MB](model/fcn-resnet101-11.onnx) | [281 MB](model/fcn-resnet101-11.tar.gz) | 1.8.0 | 11 | 63.7% |
16+
| FCN ResNet-50 | [134 MB](model/fcn-resnet50-12.onnx) | [125 MB](model/fcn-resnet50-12.tar.gz) | 1.8.0 | 12 | 60.5% |
17+
| FCN ResNet-50-int8 | [34 MB](model/fcn-resnet50-12-int8.onnx) | [29 MB](model/fcn-resnet50-12-int8.tar.gz) | 1.8.0 | 12 | 64.7% |
1618

1719
### Source
1820

1921
* PyTorch Torchvision FCN ResNet50 ==> ONNX FCN ResNet50
2022
* PyTorch Torchvision FCN ResNet101 ==> ONNX FCN ResNet101
23+
* ONNX FCN ResNet50 ==> Quantized ONNX FCN ResNet50
2124

2225
## Inference
2326

@@ -129,18 +132,53 @@ If you have the [COCO val2017 dataset](https://cocodataset.org/#download) downlo
129132
| Model | mean IoU | global pixelwise accuracy |
130133
|----------------|:---------|:--------------------------|
131134
| FCN ResNet 50 | 65.0 | 99.6 |
135+
| FCN ResNet 50-int8 | 64.7 | 99.5 |
132136
| FCN ResNet 101 | 66.7 | 99.6 |
133137

134138
The more conservative of the two estimates is used in the model files table.
139+
140+
> Compared with the fp32 FCN ResNet 50, FCN ResNet 50-int8's mean IoU drop ratio is 0.46% global pixelwise accuracy drop ratio is 0.10% and performance improvement is 1.28x.
141+
>
142+
> **Note**
143+
>
144+
>The performance depends on the test hardware. Performance data here is collected with Intel® Xeon® Platinum 8280 Processor, 1s 4c per inst ance, CentOS Linux 8.3, data batch size is 1.
135145
<hr>
136146
147+
## Quantization
148+
FCN ResNet 50-int8 is obtained by quantizing fp32 FCN ResNet 50 model. We use [Intel® Neural Compressor](https://github.com/intel/neural-compressor) with onnxruntime backend to perform quantization. View the [instructions](https://github.com/intel/neural-compressor/blob/master/examples/onnxrt/image_recognition/onnx_model_zoo/fcn/quantization/ptq/README.md) to understand how to use Intel® Neural Compressor for quantization.
149+
150+
### Environment
151+
onnx: 1.9.0
152+
onnxruntime: 1.8.0
153+
154+
### Prepare model
155+
```shell
156+
wget https://github.com/onnx/models/raw/master/vision/object_detection_segmentation/fcn/model/fcn-resnet50-12.onnx
157+
```
158+
159+
### Model quantize
160+
Make sure to specify the appropriate dataset path in the configuration file.
161+
```bash
162+
bash run_tuning.sh --input_model=path/to/model \ # model path as *.onnx
163+
--config=fcn_rn50.yaml \
164+
--data_path=path/to/coco/val2017 \
165+
--label_path=path/to/coco/annotations/instances_val2017.json \
166+
--output_model=path/to/save
167+
```
168+
137169
## References
138-
Jonathan Long, Evan Shelhamer, Trevor Darrell; Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2015, pp. 3431-3440
170+
* Jonathan Long, Evan Shelhamer, Trevor Darrell; Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2015, pp. 3431-3440
171+
172+
* This model is converted from the [Torchvision Model Zoo](https://pytorch.org/docs/stable/torchvision/models.html), originally implemented by Francisco Moss [here](https://github.com/pytorch/vision/tree/master/torchvision/models/segmentation/fcn.py).
139173

140-
This model is converted from the [Torchvision Model Zoo](https://pytorch.org/docs/stable/torchvision/models.html), originally implemented by Francisco Moss [here](https://github.com/pytorch/vision/tree/master/torchvision/models/segmentation/fcn.py).
174+
* [Intel® Neural Compressor](https://github.com/intel/neural-compressor)
141175

142176
## Contributors
143-
[Jack Duvall](https://github.com/duvallj)
177+
* [Jack Duvall](https://github.com/duvallj)
178+
* [mengniwang95](https://github.com/mengniwang95) (Intel)
179+
* [airMeng](https://github.com/airMeng) (Intel)
180+
* [ftian1](https://github.com/ftian1) (Intel)
181+
* [hshen14](https://github.com/hshen14) (Intel)
144182

145183
## License
146184
MIT License
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version https://git-lfs.github.com/spec/v1
2+
oid sha256:67fcba8ebd435c2fb6b297d2e7c084f3c3b9ae6bc7ae41453b748ae4ed8c0331
3+
size 35545058

0 commit comments

Comments
 (0)