CoolFace
Modelpublic

AnnotateIt/rfdetr-seg-nano-coco-onnx

sourceHugging Faceapache-2.0updated 8d agoView on Hugging Face
0likes195downloads
Model Card

<!-- annotateit-brand:start --> <p><a href="https://huggingface.co/AnnotateIt"><img src="https://huggingface.co/spaces/AnnotateIt/README/resolve/d399a89b9d5dcf41afbe7cf29bf99c9028bc51e2/assets/annotateit-logo.png" width="48" height="48" alt="AnnotateIt"></a></p>

[AnnotateIt](https://annotateit.ai/) · [Open the app](https://app.annotateit.ai/) · [Models & datasets](https://huggingface.co/AnnotateIt) · [Documentation](https://annotateit.ai/docs/) <!-- annotateit-brand:end -->

RF-DETR Seg Nano — FP32 ONNX (COCO instance segmentation)

An independent, unofficial FP32 ONNX conversion of Roboflow's RF-DETR Seg Nano pretrained checkpoint, produced and validated for AnnotateIt's local, in-browser auto-annotation. Exported with the official rfdetr exporter — not a re-implementation.

  • —Upstream: `roboflow/rf-detr` tag 1.9.4 (commit 9b009fa928d6218320439803d1da01869a85c072), checkpoint `Roboflow/rf-detr-seg-nano` — Apache-2.0.
  • —Task: instance segmentation, 80 COCO thing classes in a sparse COCO-91 logits layout.
  • —Precision: FP32 · opset 17 · fixed batch 1 · input 312×312 · 33,577,475 parameters.
  • —model.onnx: 122,833,543 bytes · SHA-256 c03620923d319de71fc756c8585e2585a5ecc6e3d4398cf298c8d2991ceb37c6.

Official upstream metrics (as reported by Roboflow)

MetricValue
COCO mask AP 50:9540.3
COCO mask AP5063.0
Parameters33.6 M
Latency3.4 ms — measured on NVIDIA T4, TensorRT 10.4, CUDA 12.4, FP16, batch 1 (not a browser/CPU/WASM figure)

This conversion's measured results

Full COCO val2017 (5000 images) was re-evaluated for BOTH the pinned PyTorch checkpoint and this ONNX graph, with the official preprocessing and postprocessing (see validation-report.json):

Backendbbox APsegm APsegm AP50
PyTorch 2.13.0 (CPU)0.48410.40110.6241
ONNX Runtime 1.29.0 (CPU)0.48410.40100.6241

Torch↔ONNX segm-AP agreement is 0.001 AP points. The small gap to the official 40.3 is protocol-level (this evaluation pins num_select=100 and the deploy preprocessing); no metric here is claimed as an improvement or replacement of the upstream number.

In-browser (headless Chrome 151, onnxruntime-web 1.24.3, WASM/CPU EP, single thread): session init 469 ms, first run 1079 ms, warm p50 1049 ms — with selected-query parity vs Python ORT of max score Δ 1.15e-03, max box Δ 1.82e-04 (normalized), min mask IoU 0.9991 at the logit-0 cut. Repeated inference retains no heap growth (forced-GC check).

Contract

Input input: float32 [1, 3, 312, 312], RGB, NCHW. Preprocessing: stretch-resize to 312×312 (bilinear, half-pixel, antialias off — F.resize(antialias=False) ≈ cv2.INTER_LINEAR), scale to [0,1], normalize with ImageNet mean [0.485, 0.456, 0.406] / std [0.229, 0.224, 0.225]. No letterbox, no padding.

Outputs (the official exporter's names are counterintuitive — `labels` holds the logits, `dets` the boxes):

NameShapeMeaning
dets[1, 100, 4]cxcywh boxes, normalized 0..1 (regression is unbounded — clamp after conversion)
labels[1, 100, 91]raw class logits (sigmoid per cell; sparse COCO-91 columns)
masks[1, 100, 78, 78]per-query mask logits

Postprocessing (the official PostProcess semantics): sigmoid(labels) → stable global top-K over the flattened 100×91 scores (num_select=100; ties broken by ascending flattened index) → queryIndex = flat // 91, classIndex = flat % 91 → keep score > threshold (default 0.5, strict) → gather dets[queryIndex], convert cxcywh→xyxy, scale, clamp → gather masks[queryIndex] for kept rows only, resize bilinear (align_corners=False) to the image size, binarize at logit > 0.0. No NMS. A query may be selected more than once for different classes.

Class ids are native sparse COCO-91 (person=1, car=3, …, toothbrush=90; index 0 is the background slot and ten N/A holes exist) — never compact them to contiguous COCO-80 and never shift by one.

Files

model.onnx · config.json · manifest.json · validation-report.json · annotateit-compatibility.md · LICENSE · NOTICE · SHA256SUMS · export/ (reproducible export + verification scripts and the exact dependency freeze).

Reproducing

bash
python3.12 -m venv venv && venv/bin/pip install -r export/requirements-lock.txt
venv/bin/python export/export_rfdetr_seg_nano.py --work-dir work

The exporter seeds the trace input; two consecutive builds are byte-identical (c03620923d319de71fc756c8585e2585a5ecc6e3d4398cf298c8d2991ceb37c6 both times).

License

Apache-2.0, matching the upstream model and code. Full Apache-2.0 text included as LICENSE. This is an independent conversion — not endorsed by or affiliated with Roboflow.