CoolFace
Modelpublic

AnnotateIt/rfdetr-seg-small-coco-onnx

sourceHugging Faceapache-2.0updated 8d agoView on Hugging Face
0likes176downloads
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 Small — FP32 ONNX (COCO instance segmentation)

An independent, unofficial FP32 ONNX conversion of Roboflow's RF-DETR Seg Small 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-small` — 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 384×384 · 33,711,107 parameters.
  • —model.onnx: 123,380,405 bytes · SHA-256 561a630d72d90aaf416a96bf6539b1b004b7e6692eb1780e7e90c7e59a78e034.

Official upstream metrics (as reported by Roboflow)

MetricValue
COCO mask AP 50:9543.1
COCO mask AP5066.2
Parameters33.7M
Latency4.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 (CPU)0.51080.42970.6624
ONNX Runtime 1.29.0 (CPU)0.51070.42960.6624

Torch↔ONNX segm-AP agreement is 0.007 AP points. Comparison with the official 43.1 uses a different evaluation protocol (this evaluation pins num_select=100 and the deploy preprocessing); no metric here is claimed as an improvement or replacement of the upstream number.

The recorded browser gate covers Chromium only (Chromium 151 (launch channel external), onnxruntime-web 1.24.3, WASM EP, single thread): session init 703 ms, first run 1628 ms, warm p50 1499 ms — with selected-query parity vs Python ORT of max score Δ 4.77e-07, max box Δ 3.58e-07 (normalized), min mask IoU 1.0000 at the logit-0 cut. The browser-canvas compatibility proxy matched Python's detection count and classes; it uses canvas.drawImage, not the product's OpenCV INTER_LINEAR preprocessing. WKWebView and WebView2 were not exercised. An optional V8 JS-heap diagnostic is recorded when available; its gc_forced field states whether garbage collection could be forced. It excludes WASM linear memory and is not a memory-leak gate.

Contract

Input input: float32 [1, 3, 384, 384], RGB, NCHW. Preprocessing: stretch-resize to 384×384 (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, 96, 96]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
./export/reproduce.sh

On Windows:

bat
export\reproduce.cmd

Both launchers call the portable export/reproduce.py runner using paths relative to the package, independent of the caller's current directory. It creates a platform-native venv, rebuilds twice, and fails unless the rebuilt bytes have release SHA-256 561a630d72d90aaf416a96bf6539b1b004b7e6692eb1780e7e90c7e59a78e034.

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.