Views
No views yet

onnx/model_fp16.onnx is the only build published here. fp16 weights and
compute, fp32 inputs and outputs, so you feed it a normal float32 array. It is
mixed precision: its GridSample nodes stay at fp32, because onnxruntime-web's
fp16 GridSample shader is broken on WebGPU and fails by returning wrong boxes
rather than by erroring.https://storage.googleapis.com/rfdetr/small_coco/checkpoint_best_regular.pth,
RFDETRSmall() downloads it for you, and model.export() writes ONNX. The
full recipe this repo uses, including the onnxslim step, is in
.agents/skills/cut-release/references/export.md.stevenbucaille/rf-detr-small,
which is the same checkpoint converted, and which this export was verified
against.input: [1, 3, 512, 512] float32 NCHW. Resolution is fixed.dets: [1, 300, 4] float32, boxes in cxcywh normalized 0..1.labels: [1, 300, 91] float32, raw logits. Apply sigmoid.[0, 1], ImageNet mean [0.485, 0.456, 0.406] and std
[0.229, 0.224, 0.225], NCHW. The cost of the crop is field of view. A 16:9
frame loses about 44% of its width.N/A background slot and is never read.
The 80 real categories sit sparsely across indices 1 to 90, with ten N/A gaps
where COCO retired a category id. Assuming a dense 0..79 table reads the wrong
label for most of the classes. So sigmoid the logits, and per query take the
highest scoring index that the model's own names map actually names. One box
gets one label. Boxes are normalized to the cropped square, not the original
frame, so map them back through the crop origin.metadata_props. Read them with
ort.InferenceSession(path).get_modelmeta().custom_metadata_map, or open the
file in Netron. The keys follow the convention Ultralytics' YOLO exporter set,
so the values are Python reprs rather than JSON. Parse names with
ast.literal_eval and you get 80 entries keyed by integer logit index, sparse
across 1 to 90 to match the head. That map is the only machine readable record
of what a slot means, so read it from the file instead of shipping your own
table.1import ast
2import numpy as np, onnxruntime as ort
3from PIL import Image
4
5MEAN = np.array([0.485, 0.456, 0.406], np.float32)
6STD = np.array([0.229, 0.224, 0.225], np.float32)
7THRESHOLD = 0.35 # the upstream example's value, not tuned. See below.
8
9img = Image.open("input.jpg").convert("RGB")
10W, H = img.size
11side = min(W, H)
12x0, y0 = (W - side) // 2, (H - side) // 2
13square = img.crop((x0, y0, x0 + side, y0 + side)).resize((512, 512), Image.BILINEAR)
14x = ((np.asarray(square, np.float32) / 255.0 - MEAN) / STD).transpose(2, 0, 1)[None]
15
16sess = ort.InferenceSession("onnx/model_fp16.onnx", providers=["CPUExecutionProvider"])
17out = dict(zip([o.name for o in sess.get_outputs()], sess.run(None, {sess.get_inputs()[0].name: x})))
18names = ast.literal_eval(sess.get_modelmeta().custom_metadata_map["names"])
19
20named = np.array(sorted(names)) # the 80 logit slots that mean something
21prob = 1 / (1 + np.exp(-out["labels"][0])) # [queries, 91]
22best = named[prob[:, named].argmax(1)]
23score = prob[:, named].max(1)
24
25cx, cy, bw, bh = out["dets"][0].T
26xyxy = np.stack([x0 + (cx - bw / 2) * side, y0 + (cy - bh / 2) * side,
27 x0 + (cx + bw / 2) * side, y0 + (cy + bh / 2) * side], axis=1)
28
29for q in np.argsort(-score):
30 if score[q] < THRESHOLD:
31 break
32 print(f"{names[int(best[q])]} {score[q]:.2f} at {xyxy[q].round().astype(int).tolist()}")https://huggingface.co/tuxracer/coco-rfdetr-small/resolve/v1.0/onnx/model_fp16.onnxmain URL to the
commit sha before saving it.reference/test.jpg is COCO val2017 image id 577932, released under the
Attribution License (CC BY 2.0). The original is
http://farm5.staticflickr.com/4019/5159956078_f820c56d6f_z.jpg. It is
center-cropped from 640x543 and resized to 512x512, so it is exactly the model
input and needs no preprocessing.stevenbucaille/rf-detr-small
is the transformers conversion this export was checked against.1@misc{robinson2026rfdetrneuralarchitecturesearch,
2 title={RF-DETR: Neural Architecture Search for Real-Time Detection Transformers},
3 author={Isaac Robinson and Peter Robicheaux and Matvei Popov and Deva Ramanan and Neehar Peri},
4 year={2026},
5 eprint={2511.09554},
6 archivePrefix={arXiv},
7 primaryClass={cs.CV},
8 url={https://arxiv.org/abs/2511.09554},
9}