RT-DETRv2-S — INT8 ONNX, 45.7 AP COCO in 32.7 MB
This is RT-DETRv2-S (PekingU/rtdetr_v2_r18vd, Apache-2.0), quantized with Kenosis, Core Epoch's post-training quantizer, calibrated on 128 COCO images and no retraining. It scores 45.7 AP on COCO val2017 from a single 32.7 MB file, and the same file runs on both ONNX Runtime and OpenVINO, with no GPU required.
Measured accuracy
COCO val2017, 4,800 images, pycocotools bbox protocol. Calibration and evaluation images are disjoint, and every row was evaluated on identical inputs.
| model | AP50:95 | retention | file size |
|---|---|---|---|
| FP32 baseline | 48.1 | — | 81.0 MB |
| this artifact (INT8 + FP32 decoder) | 45.7 | 95.0% | 32.7 MB |
| ONNX Runtime static quantization at default calibration, full INT8, same calibration images | 4.2 | 8.7% | 21.5 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/rtdetrv2-s-int8-onnx", "rtdetrv2_s_640_int8.onnx")
sess = ort.InferenceSession(path, providers=["CPUExecutionProvider"])
img = Image.open("your_image.jpg").convert("RGB")
x = np.asarray(img.resize((640, 640), Image.BILINEAR), np.float32) / 255.0
logits, boxes = sess.run(None, {"input": x.transpose(2, 0, 1)[None]})
scores = 1.0 / (1.0 + np.exp(-logits[0]))
q, c = divmod(int(scores.argmax()), scores.shape[1])
print(f"top detection: class {c}, score {scores.max():.2f}, box {boxes[0][q]}")
Input: 1x3x640x640, RGB, /255 only (no mean/std normalization). Outputs:
logits [1,300,80] (contiguous COCO-80 class order) and boxes [1,300,4]
(normalized cxcywh). run_detect.py and eval_coco.py in this repo
reproduce the demo and the table against a local COCO val2017 copy.
Integrity
rtdetrv2_s_640_int8.onnx (32,667,008 bytes). SHA-256:
7EB39628C29D8B6A40AEFFDBEFCB0F923851B6F20B2DC799F005853DD4044779.
The precision layout is an INT8 backbone and encoder with an FP32 decoder.
Credits
Base architecture:
@article{lv2024rtdetrv2,
title={RT-DETRv2: Improved Baseline with Bag-of-Freebies for Real-Time Detection Transformer},
author={Lv, Wenyu and Zhao, Yian and Chang, Qinyao and Huang, Kui and Wang, Guanzhong and Liu, Yi},
journal={arXiv preprint arXiv:2407.17140},
year={2024}
}
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/rtdetrv2-s-int8-onnx
Base model
PekingU/rtdetr_v2_r18vd