Views
No views yet
| Model | Download | Download (with sample test data) | ONNX version | Opset version | Top-1 accuracy (%) | Top-5 accuracy (%) |
|---|---|---|---|---|---|---|
| GoogleNet | 28 MB | 31 MB | 1.1 | 3 | ||
| GoogleNet | 28 MB | 31 MB | 1.1.2 | 6 | ||
| GoogleNet | 28 MB | 31 MB | 1.2 | 7 | ||
| GoogleNet | 28 MB | 31 MB | 1.3 | 8 | ||
| GoogleNet | 28 MB | 31 MB | 1.4 | 9 | ||
| GoogleNet | 27 MB | 25 MB | 1.9 | 12 | 67.78 | 88.34 |
| GoogleNet-int8 | 7 MB | 5 MB | 1.9 | 12 | 67.73 | 88.32 |
| GoogleNet-qdq | 7 MB | 5 MB | 1.12 | 12 | 67.73 | 88.31 |
Compared with the fp32 GoogleNet, int8 GoogleNet's Top-1 accuracy drop ratio is 0.07%, Top-5 accuracy drop ratio is 0.02% and performance improvement is 1.27x.NoteThe 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.
data_0: float[1, 3, 224, 224]prob_0: float[1, 1000]1import imageio
2from PIL import Image1def get_image(path):
2'''
3Using path to image, return the RGB load image
4'''
5img = imageio.imread(path, pilmode='RGB')
6return img
7
8# Pre-processing function for ImageNet models using numpy
9def preprocess(img):
10'''
11Preprocessing required on the images for inference with mxnet gluon
12The function takes loaded image and returns processed tensor
13'''
14img = np.array(Image.fromarray(img).resize((224, 224))).astype(np.float32)
15img[:, :, 0] -= 123.68
16img[:, :, 1] -= 116.779
17img[:, :, 2] -= 103.939
18img[:,:,[0,1,2]] = img[:,:,[2,1,0]]
19img = img.transpose((2, 0, 1))
20img = np.expand_dims(img, axis=0)
21
22return img1def predict(path):
2# based on : https://mxnet.apache.org/versions/1.0.0/tutorials/python/predict_image.html
3img = get_image(path)
4img = preprocess(img)
5mod.forward(Batch([mx.nd.array(img)]))
6# Take softmax to generate probabilities
7prob = mod.get_outputs()[0].asnumpy()
8prob = np.squeeze(prob)
9a = np.argsort(prob)[::-1]
10return awget https://github.com/onnx/models/raw/main/vision/classification/inception_and_googlenet/googlenet/model/googlenet-12.onnx1bash run_tuning.sh --input_model=path/to/model \ # model path as *.onnx
2--config=googlenet.yaml \
3--data_path=/path/to/imagenet \
4--label_path=/path/to/imagenet/label \
5--output_model=path/to/save