EdgeNeXt-S β INT8 ONNX, 81.5% ImageNet in 7.2 MB
This is EdgeNeXt-S (timm/edgenext_small.usi_in1k, MIT) evaluated at 320px, quantized to INT8 with Kenosis, Core Epoch's post-training quantizer, using 128 calibration images and no retraining. It scores 81.53% top-1 on ImageNet-1K in a 7.2 MB single file, and the same file runs on both ONNX Runtime and OpenVINO, offline, with no GPU required.
Measured accuracy
ImageNet-1K validation, 49,872 images. Calibration and evaluation images are disjoint, and every row was evaluated on identical inputs.
| model | top-1 | Ξ vs FP32 | file size |
|---|---|---|---|
| FP32 baseline | 81.565% | β | 22.5 MB |
| this artifact | 81.535% | β0.030 | 7.16 MB |
| ONNX Runtime static quantization at default calibration, same model, same 128 calibration images | 33.74% | β47.8 | 6.4 MB |
Run it
pip install onnxruntime numpy pillow huggingface_hub
from huggingface_hub import hf_hub_download
import numpy as np
import onnxruntime as ort
from PIL import Image
path = hf_hub_download("CoreEpoch/edgenext-small-int8-imagenet", "edgenext_s_320_int8.onnx")
sess = ort.InferenceSession(path, providers=["CPUExecutionProvider"])
img = Image.open("your_image.jpg").convert("RGB")
scale = 320 / min(img.size) # shorter side to 320, then center crop β the measured transform
img = img.resize((round(img.width * scale), round(img.height * scale)), Image.BICUBIC)
l, t = (img.width - 320) // 2, (img.height - 320) // 2
img = img.crop((l, t, l + 320, t + 320))
x = (np.asarray(img, np.float32) / 255.0 - [0.485, 0.456, 0.406]) / [0.229, 0.224, 0.225]
logits = sess.run(None, {"input": x.transpose(2, 0, 1)[None].astype(np.float32)})[0]
print(int(np.argmax(logits)))
Input: 1x3x320x320, RGB, /255, ImageNet mean/std. Output: logits [1,1000]
in standard sorted-synset class order. run_classify.py and eval_imagenet.py
in this repo reproduce the demo and the full measurement against a local
ImageNet validation copy.
Integrity
edgenext_s_320_int8.onnx (7,160,491 bytes). SHA-256:
2900734ECF327ACFFA1DBAAB75DCB74BB4874ADBAA97FA5B365445B41458D003.
Credits
Base architecture:
@inproceedings{maaz2022edgenext,
title={EdgeNeXt: Efficiently Amalgamated CNN-Transformer Architecture for Mobile Vision Applications},
author={Maaz, Muhammad and Shaker, Abdelrahman and Cholakkal, Hisham and Khan, Salman and Zamir, Syed Waqas and Anwer, Rao Muhammad and Khan, Fahad Shahbaz},
booktitle={International Workshop on Computational Aspects of Deep Learning at 17th European Conference on Computer Vision (CADL2022)},
year={2022},
organization={Springer}
}
About
Quantized with Kenosis, Core Epoch's post-training quantizer (patent pending). To apply this to your own models: coreepoch.dev Β· core@coreepoch.dev
Model tree for CoreEpoch/edgenext-small-int8-imagenet
Base model
timm/edgenext_small.usi_in1k