Skip to content

Commit 6ab957a

Browse files
authored
add int8 alexnet, caffenet, googlenet, zfnet and squeezenet & update README (#484)
* add int8 alexnet, caffenet, googlenet, zfnet and squeezenet & update README Signed-off-by: mengniwa <[email protected]> * fix model readme Signed-off-by: mengniwa <[email protected]>
1 parent 2063d79 commit 6ab957a

26 files changed

+290
-41
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ We have standardized on [Git LFS (Large File Storage)](https://git-lfs.github.co
1010

1111
## Models
1212
#### Read the [Usage](#usage-) section below for more details on the file formats in the ONNX Model Zoo (.onnx, .pb, .npz), downloading multiple ONNX models through [Git LFS command line](#gitlfs-), and starter Python code for validating your ONNX model using test data.
13+
#### INT8 models are generated by [Intel® Neural Compressor](https://github.com/intel/neural-compressor), read the [Introduction](https://github.com/intel/neural-compressor/blob/master/README.md) to know how to use it to quantize ONNX model.
1314

1415
#### Vision
1516
* [Image Classification](#image_classification)

vision/classification/alexnet/README.md

Lines changed: 49 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,22 @@
22

33
# AlexNet
44

5-
|Model |Download |Download (with sample test data)| ONNX version |Opset version|
6-
| ------------- | ------------- | ------------- | ------------- | ------------- |
7-
|AlexNet| [238 MB](model/bvlcalexnet-3.onnx) | [225 MB](model/bvlcalexnet-3.tar.gz) | 1.1 | 3|
8-
|AlexNet| [238 MB](model/bvlcalexnet-6.onnx) | [225 MB](model/bvlcalexnet-6.tar.gz) | 1.1.2 | 6|
9-
|AlexNet| [238 MB](model/bvlcalexnet-7.onnx) | [226 MB](model/bvlcalexnet-7.tar.gz) | 1.2 | 7|
10-
|AlexNet| [238 MB](model/bvlcalexnet-8.onnx) | [226 MB](model/bvlcalexnet-8.tar.gz) | 1.3 | 8|
11-
|AlexNet| [238 MB](model/bvlcalexnet-9.onnx) | [226 MB](model/bvlcalexnet-9.tar.gz) | 1.4 | 9|
5+
|Model |Download |Download (with sample test data)| ONNX version |Opset version|Top-1 accuracy (%)|Top-5 accuracy (%)|
6+
| ------------- | ------------- | ------------- | ------------- | ------------- | ------------- | ------------- |
7+
|AlexNet| [238 MB](model/bvlcalexnet-3.onnx) | [225 MB](model/bvlcalexnet-3.tar.gz) | 1.1 | 3| | |
8+
|AlexNet| [238 MB](model/bvlcalexnet-6.onnx) | [225 MB](model/bvlcalexnet-6.tar.gz) | 1.1.2 | 6| | |
9+
|AlexNet| [238 MB](model/bvlcalexnet-7.onnx) | [226 MB](model/bvlcalexnet-7.tar.gz) | 1.2 | 7| | |
10+
|AlexNet| [238 MB](model/bvlcalexnet-8.onnx) | [226 MB](model/bvlcalexnet-8.tar.gz) | 1.3 | 8| | |
11+
|AlexNet| [238 MB](model/bvlcalexnet-9.onnx) | [226 MB](model/bvlcalexnet-9.tar.gz) | 1.4 | 9| | |
12+
|AlexNet| [233 MB](model/bvlcalexnet-12.onnx) | [216 MB](model/bvlcalexnet-12.tar.gz) | 1.9 | 12|54.80|78.23|
13+
|AlexNet-int8| [58 MB](model/bvlcalexnet-12-int8.onnx) | [39 MB](model/bvlcalexnet-12-int8.tar.gz) | 1.9 | 12|54.68|78.23|
14+
> Compared with the fp32 AlextNet, int8 AlextNet's Top-1 accuracy drop ratio is 0.22%, Top-5 accuracy drop ratio is 0.05% and performance improvement is 2.26x.
15+
>
16+
> **Note**
17+
>
18+
> Different preprocess methods will lead to different accuracies, the accuracy in table depends on this specific [preprocess method](https://github.com/intel/neural-compressor/blob/master/examples/onnxrt/onnx_model_zoo/alexnet/main.py).
19+
>
20+
> 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.
1221
1322
## Description
1423
AlexNet is the name of a convolutional neural network for classification,
@@ -18,9 +27,6 @@ Differences:
1827
- not training with the relighting data-augmentation;
1928
- initializing non-zero biases to 0.1 instead of 1 (found necessary for training, as initialization to 1 gave flat loss).
2029

21-
### Paper
22-
[ImageNet Classification with Deep Convolutional Neural Networks](https://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks.pdf)
23-
2430
### Dataset
2531
[ILSVRC2012](http://www.image-net.org/challenges/LSVRC/2012/)
2632

@@ -56,5 +62,38 @@ This model obtains a top-1 accuracy 57.1% and a top-5 accuracy
5662
(Using the average of 10 crops, (4 + 1 center) * 2 mirror,
5763
should obtain a bit higher accuracy.)
5864

65+
## Quantization
66+
AlexNet-int8 is obtained by quantizing fp32 AlexNet 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/onnx_model_zoo/alexnet/README.md) to understand how to use Intel® Neural Compressor for quantization.
67+
68+
### Environment
69+
onnx: 1.9.0
70+
onnxruntime: 1.8.0
71+
72+
### Prepare model
73+
```shell
74+
wget https://github.com/onnx/models/blob/master/vision/classification/alexnet/model/bvlcalexnet-12.onnx
75+
```
76+
77+
### Model quantize
78+
Make sure to specify the appropriate dataset path in the configuration file.
79+
```bash
80+
bash run_tuning.sh --input_model=path/to/model \ # model path as *.onnx
81+
--config=alexnet.yaml \
82+
--data_path=/path/to/imagenet \
83+
--label_path=/path/to/imagenet/label \
84+
--output_model=path/to/save
85+
```
86+
87+
## References
88+
* [ImageNet Classification with Deep Convolutional Neural Networks](https://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks.pdf)
89+
90+
* [Intel® Neural Compressor](https://github.com/intel/neural-compressor)
91+
92+
## Contributors
93+
* [mengniwang95](https://github.com/mengniwang95) (Intel)
94+
* [airMeng](https://github.com/airMeng) (Intel)
95+
* [ftian1](https://github.com/ftian1) (Intel)
96+
* [hshen14](https://github.com/hshen14) (Intel)
97+
5998
## License
6099
[BSD-3](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:d53bbedf100be79277cf55d78c72bdcb67d88786988561bf5d530f038e443c7b
3+
size 60984008
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:6ec09e19e5475c51fda2d6b6205f194969ff07199e19944934b806414b34ef2e
3+
size 40683138
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:6b0da9510f27f234ee96a85dc3809dd210150fdefad87f6850f9788513216945
3+
size 243863787
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:24abe33e5587bf8df8f824559d4b8c0d24db860efbe21152dc9536451ce8ddc1
3+
size 226657165

vision/classification/caffenet/README.md

Lines changed: 49 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,22 @@
22

33
# CaffeNet
44

5-
|Model |Download |Download (with sample test data)| ONNX version |Opset version|
6-
| ------------- | ------------- | ------------- | ------------- | ------------- |
7-
|CaffeNet| [238 MB](model/caffenet-3.onnx) | [244 MB](model/caffenet-3.tar.gz) | 1.1 | 3|
8-
|CaffeNet| [238 MB](model/caffenet-6.onnx) | [244 MB](model/caffenet-6.tar.gz) | 1.1.2 | 6|
9-
|CaffeNet| [238 MB](model/caffenet-7.onnx) | [244 MB](model/caffenet-7.tar.gz) | 1.2 | 7|
10-
|CaffeNet| [238 MB](model/caffenet-8.onnx) | [244 MB](model/caffenet-8.tar.gz) | 1.3 | 8|
11-
|CaffeNet| [238 MB](model/caffenet-9.onnx) | [244 MB](model/caffenet-9.tar.gz) | 1.4 | 9|
5+
|Model |Download |Download (with sample test data)| ONNX version |Opset version|Top-1 accuracy (%)|Top-5 accuracy (%)|
6+
| ------------- | ------------- | ------------- | ------------- | ------------- |------------- | ------------- |
7+
|CaffeNet| [238 MB](model/caffenet-3.onnx) | [244 MB](model/caffenet-3.tar.gz) | 1.1 | 3| | |
8+
|CaffeNet| [238 MB](model/caffenet-6.onnx) | [244 MB](model/caffenet-6.tar.gz) | 1.1.2 | 6| | |
9+
|CaffeNet| [238 MB](model/caffenet-7.onnx) | [244 MB](model/caffenet-7.tar.gz) | 1.2 | 7| | |
10+
|CaffeNet| [238 MB](model/caffenet-8.onnx) | [244 MB](model/caffenet-8.tar.gz) | 1.3 | 8| | |
11+
|CaffeNet| [238 MB](model/caffenet-9.onnx) | [244 MB](model/caffenet-9.tar.gz) | 1.4 | 9| | |
12+
|CaffeNet| [233 MB](model/caffenet-12.onnx) | [216 MB](model/caffenet-12.tar.gz) | 1.9 | 12|56.27 |79.52 |
13+
|CaffeNet-int8| [58 MB](model/caffenet-12-int8.onnx) | [39 MB](model/caffenet-12-int8.tar.gz) | 1.9 | 12| 56.22|79.52 |
14+
> Compared with the fp32 CaffeNet, int8 CaffeNet's Top-1 accuracy drop ratio is 0.09%, Top-5 accuracy drop ratio is 0.13% and performance improvement is 3.08x.
15+
>
16+
> **Note**
17+
>
18+
> Different preprocess methods will lead to different accuracies, the accuracy in table depends on this specific [preprocess method](https://github.com/intel/neural-compressor/blob/master/examples/onnxrt/onnx_model_zoo/caffenet/main.py).
19+
>
20+
> 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.
1221
1322
## Description
1423
CaffeNet a variant of AlexNet.
@@ -19,9 +28,6 @@ Differences:
1928
- not training with the relighting data-augmentation;
2029
- the order of pooling and normalization layers is switched (in CaffeNet, pooling is done before normalization).
2130

22-
### Paper
23-
[ImageNet Classification with Deep Convolutional Neural Networks](https://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks.pdf)
24-
2531
### Dataset
2632
[ILSVRC2012](http://www.image-net.org/challenges/LSVRC/2012/)
2733

@@ -57,5 +63,38 @@ This model obtains a top-1 accuracy 57.4% and a top-5 accuracy
5763
(Using the average of 10 crops, (4 + 1 center) * 2 mirror,
5864
should obtain a bit higher accuracy still.)
5965

66+
## Quantization
67+
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/onnx_model_zoo/caffenet/README.md) to understand how to use Intel® Neural Compressor for quantization.
68+
69+
### Environment
70+
onnx: 1.9.0
71+
onnxruntime: 1.8.0
72+
73+
### Prepare model
74+
```shell
75+
wget https://github.com/onnx/models/blob/master/vision/classification/caffenet/model/caffenet-12.onnx
76+
```
77+
78+
### Model quantize
79+
Make sure to specify the appropriate dataset path in the configuration file.
80+
```bash
81+
bash run_tuning.sh --input_model=path/to/model \ # model path as *.onnx
82+
--config=caffenet.yaml \
83+
--data_path=/path/to/imagenet \
84+
--label_path=/path/to/imagenet/label \
85+
--output_model=path/to/save
86+
```
87+
88+
## References
89+
* [ImageNet Classification with Deep Convolutional Neural Networks](https://papers.nips.cc/paper/4824-imagenet-classification-with-deep-convolutional-neural-networks.pdf)
90+
91+
* [Intel® Neural Compressor](https://github.com/intel/neural-compressor)
92+
93+
## Contributors
94+
* [mengniwang95](https://github.com/mengniwang95) (Intel)
95+
* [airMeng](https://github.com/airMeng) (Intel)
96+
* [ftian1](https://github.com/ftian1) (Intel)
97+
* [hshen14](https://github.com/hshen14) (Intel)
98+
6099
## License
61100
[BSD-3](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:ee44f74d2582aa4ca7131929cd28b2a07f5f39f951d8d4f997fffcbed42aa61d
3+
size 60984071
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:24deead9c27254631332923c021c6b9cb429ef19b3367a0cc1cb171b9375c0e5
3+
size 40718510
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:ea563e5c47d1f58e1717cf1a2d8bf288b8adc07af0ad228b622096cd243aeecb
3+
size 243863798

0 commit comments

Comments
 (0)