D-FINE-N (COCO), ONNX for the browser
D-FINE nano, trained on COCO, exported to ONNX so it runs in
ONNX Runtime Web on WebGPU and WASM. It's the default object detector in
@64tensor/retouch-ml.
The weights are the D-FINE authors', from
ustc-community/dfine-nano-coco at
066438d. export.py rebuilds model.onnx byte for byte and checks it against PyTorch.
Why this export: onnx-community/dfine_n_coco-ONNX scored every detection under 0.5 in our tests,
and a plain export fails on WebGPU. This file has two graph changes for WebGPU, and neither changes
the outputs:
ceil_modeis dropped from a stride-1 MaxPool, where it has no effect.- The 1-D second input of three MatMuls in
decoder/integralbecomes a column.
Input and output
| Name | Shape | |
|---|---|---|
pixel_values |
[1, 3, 640, 640] float32 |
RGB, 0β1, the image resized to 640Γ640 (no letterbox) |
logits |
[1, 300, 80] |
per-class logits; sigmoid gives the score |
pred_boxes |
[1, 300, 4] |
center x, center y, width, height, 0β1 of the image |
Keep each query's best class above your threshold. No NMS is needed.
Accuracy and speed
On 500 COCO val2017 images: AP 45.9, AP50 63.4 (YOLOX-nano: 27.4, 43.1). In Chrome on an M1 Max, a 640Γ640 run takes about 22 ms on WebGPU and 230 ms on single-threaded WASM.
License
Apache-2.0, as are the D-FINE code and weights: see LICENSE. Copyright (c) 2024 The D-FINE Authors. The export script is 64Tensor's, under the same license.
Citation
@misc{peng2024dfine,
title={D-FINE: Redefine Regression Task in DETRs as Fine-grained Distribution Refinement},
author={Yansong Peng and Hebei Li and Peixi Wu and Yueyi Zhang and Xiaoyan Sun and Feng Wu},
year={2024},
eprint={2410.13842},
archivePrefix={arXiv},
}
Model tree for 64Tensor/dfine-n-coco-onnx
Base model
ustc-community/dfine-nano-coco