Skip to content

Commit 69c5d37

Browse files
authored
Add emotion_ferplus and ultraface int8 models (#618)
* upload emotion_ferplus and ultraface int8 models Signed-off-by: yuwenzho <[email protected]> * update ONNX_HUB_MANIFEST Signed-off-by: yuwenzho <[email protected]> --------- Signed-off-by: yuwenzho <[email protected]>
1 parent e49c41d commit 69c5d37

File tree

7 files changed

+174
-1
lines changed

7 files changed

+174
-1
lines changed

ONNX_HUB_MANIFEST.json

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,6 +1073,48 @@
10731073
"model_with_data_bytes": 237272167
10741074
}
10751075
},
1076+
{
1077+
"model": "Emotion FERPlus int8",
1078+
"model_path": "vision/body_analysis/emotion_ferplus/model/emotion-ferplus-12-int8.onnx",
1079+
"onnx_version": "1.14",
1080+
"opset_version": 12,
1081+
"metadata": {
1082+
"model_sha": "3e47195d79e9593294df9e81a6d296a1e10969b68a717284081c29493a0ff5f1",
1083+
"model_bytes": 19300656,
1084+
"tags": [
1085+
"vision",
1086+
"body analysis",
1087+
"emotion ferplus"
1088+
],
1089+
"io_ports": {
1090+
"inputs": [
1091+
{
1092+
"name": "Input3",
1093+
"shape": [
1094+
1,
1095+
1,
1096+
64,
1097+
64
1098+
],
1099+
"type": "tensor(float)"
1100+
}
1101+
],
1102+
"outputs": [
1103+
{
1104+
"name": "Plus692_Output_0",
1105+
"shape": [
1106+
1,
1107+
8
1108+
],
1109+
"type": "tensor(float)"
1110+
}
1111+
]
1112+
},
1113+
"model_with_data_path": "vision/body_analysis/emotion_ferplus/model/emotion-ferplus-12-int8.tar.gz",
1114+
"model_with_data_sha": "429cd3e9cdfc20330b76361c65e7aaeb4298b9edcd29282fd6f63b95aee00983",
1115+
"model_with_data_bytes": 18119569
1116+
}
1117+
},
10761118
{
10771119
"model": "Emotion FERPlus",
10781120
"model_path": "vision/body_analysis/emotion_ferplus/model/emotion-ferplus-2.onnx",
@@ -1175,6 +1217,58 @@
11751217
"model_with_data_bytes": 32384240
11761218
}
11771219
},
1220+
{
1221+
"model": "version-RFB-320-int8",
1222+
"model_path": "vision/body_analysis/ultraface/models/version-RFB-320-int8.onnx",
1223+
"onnx_version": "1.14",
1224+
"opset_version": 12,
1225+
"metadata": {
1226+
"model_sha": "093a9a55ff05fd71ace744593fd0c81eab8306d6d8c38b0892c5b3cff7f08265",
1227+
"model_bytes": 458144,
1228+
"tags": [
1229+
"vision",
1230+
"body analysis",
1231+
"ultraface"
1232+
],
1233+
"io_ports": {
1234+
"inputs": [
1235+
{
1236+
"name": "input",
1237+
"shape": [
1238+
1,
1239+
3,
1240+
240,
1241+
320
1242+
],
1243+
"type": "tensor(float)"
1244+
}
1245+
],
1246+
"outputs": [
1247+
{
1248+
"name": "scores",
1249+
"shape": [
1250+
1,
1251+
4420,
1252+
2
1253+
],
1254+
"type": "tensor(float)"
1255+
},
1256+
{
1257+
"name": "boxes",
1258+
"shape": [
1259+
1,
1260+
4420,
1261+
4
1262+
],
1263+
"type": "tensor(float)"
1264+
}
1265+
]
1266+
},
1267+
"model_with_data_path": "vision/body_analysis/ultraface/models/version-RFB-320-int8.tar.gz",
1268+
"model_with_data_sha": "a0010e6a58f9e4ca553efbd8d9cf539c8846fbd56e17e10c8b9aebc9f4d625d0",
1269+
"model_with_data_bytes": 1211441
1270+
}
1271+
},
11781272
{
11791273
"model": "version-RFB-320",
11801274
"model_path": "vision/body_analysis/ultraface/models/version-RFB-320.onnx",

vision/body_analysis/emotion_ferplus/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ This model is a deep convolutional neural network for emotion recognition in fac
1212
|Emotion FERPlus |[34 MB](model/emotion-ferplus-2.onnx)|[31 MB](model/emotion-ferplus-2.tar.gz)|1.0|2|
1313
|Emotion FERPlus |[34 MB](model/emotion-ferplus-7.onnx)|[31 MB](model/emotion-ferplus-7.tar.gz)|1.2|7|
1414
|Emotion FERPlus |[34 MB](model/emotion-ferplus-8.onnx)|[31 MB](model/emotion-ferplus-8.tar.gz)|1.3|8|
15+
|Emotion FERPlus int8 |[19 MB](model/emotion-ferplus-12-int8.onnx)|[18 MB](model/emotion-ferplus-12-int8.tar.gz)|1.14|12|
1516

1617
### Paper
1718
"Training Deep Networks for Facial Expression Recognition with Crowd-Sourced Label Distribution" [arXiv:1608.01041](https://arxiv.org/abs/1608.01041)
@@ -69,5 +70,35 @@ def postprocess(scores):
6970
Sets of sample input and output files are provided in
7071
* serialized protobuf TensorProtos (`.pb`), which are stored in the folders `test_data_set_*/`.
7172

73+
## Quantization
74+
Emotion FERPlus int8 is obtained by quantizing fp32 Emotion FERPlus 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/body_analysis/onnx_model_zoo/emotion_ferplus/quantization/ptq_static/README.md) to understand how to use Intel® Neural Compressor for quantization.
75+
76+
77+
### Prepare Model
78+
Download model from [ONNX Model Zoo](https://github.com/onnx/models).
79+
80+
```shell
81+
wget https://github.com/onnx/models/raw/main/vision/body_analysis/emotion_ferplus/model/emotion-ferplus-8.onnx
82+
```
83+
84+
Convert opset version to 12 for more quantization capability.
85+
86+
```python
87+
import onnx
88+
from onnx import version_converter
89+
model = onnx.load('emotion-ferplus-8.onnx')
90+
model = version_converter.convert_version(model, 12)
91+
onnx.save_model(model, 'emotion-ferplus-12.onnx')
92+
```
93+
94+
### Model quantize
95+
96+
```bash
97+
cd neural-compressor/examples/onnxrt/body_analysis/onnx_model_zoo/emotion_ferplus/quantization/ptq_static
98+
bash run_tuning.sh --input_model=path/to/model \ # model path as *.onnx
99+
--dataset_location=/path/to/data \
100+
--output_model=path/to/save
101+
```
102+
72103
## License
73104
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:3e47195d79e9593294df9e81a6d296a1e10969b68a717284081c29493a0ff5f1
3+
size 19300656
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:429cd3e9cdfc20330b76361c65e7aaeb4298b9edcd29282fd6f63b95aee00983
3+
size 18119569

vision/body_analysis/ultraface/README.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ This model is a lightweight facedetection model designed for edge computing devi
1010
| ------------- | ------------- | ------------- | ------------- | ------------- |
1111
|version-RFB-320| [1.21 MB](models/version-RFB-320.onnx) | [1.92 MB](models/version-RFB-320.tar.gz) | 1.4 | 9 |
1212
|version-RFB-640| [1.51 MB](models/version-RFB-640.onnx) | [4.59 MB](models/version-RFB-640.tar.gz) | 1.4 | 9 |
13+
|version-RFB-320-int8| [0.44 MB](models/version-RFB-320-int8.onnx) | [1.2 MB](models/version-RFB-320-int8.tar.gz) | 1.14 | 12 |
1314

1415
### Dataset
1516
The training set is the VOC format data set generated by using the cleaned widerface labels provided by [Retinaface](https://arxiv.org/pdf/1905.00641.pdf) in conjunction with the widerface [dataset](http://shuoyang1213.me/WIDERFACE/).
@@ -43,8 +44,43 @@ The model outputs two arrays `(1 x 4420 x 2)` and `(1 x 4420 x 4)` of scores and
4344
### Postprocessing
4445
In postprocessing, threshold filtration and [non-max suppression](dependencies/box_utils.py) are applied to the scores and boxes arrays.
4546

47+
48+
## Quantization
49+
version-RFB-320-int8 is obtained by quantizing fp32 version-RFB-320 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/body_analysis/onnx_model_zoo/ultraface/quantization/ptq_static/README.md) to understand how to use Intel® Neural Compressor for quantization.
50+
51+
52+
### Prepare Model
53+
Download model from [ONNX Model Zoo](https://github.com/onnx/models).
54+
55+
```shell
56+
wget https://github.com/onnx/models/raw/main/vision/body_analysis/ultraface/models/version-RFB-320.onnx
57+
```
58+
59+
Convert opset version to 12 for more quantization capability.
60+
61+
```python
62+
import onnx
63+
from onnx import version_converter
64+
model = onnx.load('version-RFB-320.onnx')
65+
model = version_converter.convert_version(model, 12)
66+
onnx.save_model(model, 'version-RFB-320-12.onnx')
67+
```
68+
69+
### Model quantize
70+
71+
```bash
72+
cd neural-compressor/examples/onnxrt/body_analysis/onnx_model_zoo/ultraface/quantization/ptq_static
73+
bash run_tuning.sh --input_model=path/to/model \ # model path as *.onnx
74+
--dataset_location=/path/to/data \
75+
--output_model=path/to/save
76+
```
77+
4678
## Contributors
47-
Valery Asiryan ([asiryan](https://github.com/asiryan))
79+
80+
* [asiryan](https://github.com/asiryan)
81+
* [yuwenzho](https://github.com/yuwenzho) (Intel)
82+
* [ftian1](https://github.com/ftian1) (Intel)
83+
* [hshen14](https://github.com/hshen14) (Intel)
4884

4985
## License
5086
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:093a9a55ff05fd71ace744593fd0c81eab8306d6d8c38b0892c5b3cff7f08265
3+
size 458144
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:a0010e6a58f9e4ca553efbd8d9cf539c8846fbd56e17e10c8b9aebc9f4d625d0
3+
size 1211441

0 commit comments

Comments
 (0)