Views
No views yet
| Model | Download | Download (with sample test data) | ONNX version | Opset version |
|---|---|---|---|---|
| Emotion FERPlus | 34 MB | 31 MB | 1.0 | 2 |
| Emotion FERPlus | 34 MB | 31 MB | 1.2 | 7 |
| Emotion FERPlus | 34 MB | 31 MB | 1.3 | 8 |
| Emotion FERPlus int8 | 19 MB | 18 MB | 1.14 | 12 |
(Nx1x64x64), where N is the batch size.image_path to the image you would like to score:1import numpy as np
2from PIL import Image
3
4def preprocess(image_path):
5input_shape = (1, 1, 64, 64)
6img = Image.open(image_path)
7img = img.resize((64, 64), Image.ANTIALIAS)
8img_data = np.array(img)
9img_data = np.resize(img_data, input_shape)
10return img_data(1x8) array of scores corresponding to the 8 emotion classes, where the labels map as follows:
emotion_table = {'neutral':0, 'happiness':1, 'surprise':2, 'sadness':3, 'anger':4, 'disgust':5, 'fear':6, 'contempt':7}1import numpy as np
2
3def softmax(scores):
4# your softmax function
5
6def postprocess(scores):
7'''
8This function takes the scores generated by the network and returns the class IDs in decreasing
9order of probability.
10'''
11prob = softmax(scores)
12prob = np.squeeze(prob)
13classes = np.argsort(prob)[::-1]
14return classes.pb), which are stored in the folders test_data_set_*/.wget https://github.com/onnx/models/raw/main/vision/body_analysis/emotion_ferplus/model/emotion-ferplus-8.onnx1import onnx
2from onnx import version_converter
3model = onnx.load('emotion-ferplus-8.onnx')
4model = version_converter.convert_version(model, 12)
5onnx.save_model(model, 'emotion-ferplus-12.onnx')1cd neural-compressor/examples/onnxrt/body_analysis/onnx_model_zoo/emotion_ferplus/quantization/ptq_static
2bash run_tuning.sh --input_model=path/to/model \ # model path as *.onnx
3--dataset_location=/path/to/data \
4--output_model=path/to/save