AnnotateIt/dfine-nano-coco-onnx
<!-- 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 -->
D-FINE Nano COCO — verified ONNX export for AnnotateIt
This repository contains a fixed-shape FP32 ONNX export of the official `ustc-community/dfine-nano-coco` checkpoint for local, in-browser object detection in AnnotateIt.
This is an AnnotateIt-maintained conversion, not an official D-FINE release. The ONNX graph was exported from the exact upstream revision `066438d3d8f0da137a37b38fdf3368fd4afceced`, which contains the upstream weight fix published on 20 August 2025.
Artifact
The shape is intentionally fixed to batch 1 at 640×640. A dynamic-shape export was rejected during validation because it did not preserve the reference model's outputs.
Preprocessing and outputs
- Convert the image to RGB.
- Resize to 640×640 with bilinear interpolation (stretch, without letterboxing).
- Rescale each channel to
[0, 1]by dividing by 255. - Convert HWC to NCHW and add a batch dimension.
- Apply sigmoid to
logits, then take the best class score per query. - Interpret
pred_boxesas normalizedcx, cy, width, heightand map them back to the original image dimensions.
The model uses the 80 COCO classes. No NMS is required by the reference postprocessor.
Validation
The graph passed all of the following checks:
- ONNX graph validation and ONNX Runtime CPU inference;
- numerical comparison with the pinned official PyTorch checkpoint;
- inference with AnnotateIt's installed
onnxruntime-web1.24.3 WASM runtime; - a real COCO reference image, where PyTorch and ONNX returned the same five detections at a 0.3 score threshold, with matching classes, scores, and boxes.
See `validation-report.json` for measured tolerances and `PROVENANCE.md` for the reproducible source/export record. Runtime timings in the report are smoke-test observations, not benchmarks.
Why this is a fresh export
The pre-existing ONNX Community conversion was created before the official checkpoint's August 2025 weight fix. It accurately represents the older checkpoint but does not match the current official weights. This repository therefore exports the current pinned checkpoint locally instead of copying that older graph.
License
D-FINE and the source checkpoint are licensed under Apache License 2.0. The full license text is included in `LICENSE`. Please retain the license and attribution when redistributing this model.
Upstream project: `Peterande/D-FINE`
