Testing Desk Object Detection with D-FINE ONNX
Hello, everyone.
Have you ever wondered how naturally AI can recognize the objects sitting on a desk? I think this kind of everyday scene understanding is one of the first things that matters when building agents with vision.
Today, I tested a D-FINE ONNX model on a desk scene and checked both the detection results and CPU inference speed.
What we are verifying
D-FINE is an object detection model. Object detection means finding both the class of an object and where it appears in an image. In this test, I used the ONNX version. ONNX is a model format designed to make trained models easier to run across different runtimes.
The input is a single image containing objects such as a laptop, cell phone, cup, bottle, books, and chair. I verified the following points:
- How well a COCO-pretrained model can detect objects on a desk
- Inference time per run on CPU with a 640x640 input
- Whether bounding boxes can be mapped back to the original image coordinates and visualized
Target lab: kiarina/labs/2026/07/09/dfine-object-detection
Reproducing the environment
You can build the verification environment and run it locally using the commands below. mise and uv are required. The first run also needs an internet connection because it downloads the model files from Hugging Face.
git clone --depth 1 --filter=blob:none --sparse \
https://github.com/kiarina/labs.git
cd labs
git sparse-checkout set .gitignore .mise/tasks Makefile mise.toml 2026/07/09/dfine-object-detection
make download-test-assets
mise -C 2026/07/09/dfine-object-detection run
Model and License
The model used here is onnx-community/dfine_s_coco-ONNX. This ONNX version is published as a converted model based on ustc-community/dfine-small-coco.
- ONNX model: onnx-community/dfine_s_coco-ONNX
- Base model: ustc-community/dfine-small-coco
- License: Apache-2.0
- Training data: COCO
- Input size: 640x640
- Runtime: ONNX Runtime CPUExecutionProvider
In the lab, the model and config are downloaded from a fixed revision and verified with SHA-256 hashes.
Image used for verification
For this test, I used a generated 1536x1024 image containing objects such as a laptop, cell phone, cup, bottle, books, and chair.
Verification results
The results executed on a Mac Studio (Apple M4 Max) are shown below. The score is roughly the confidence for the predicted label, and this test only keeps detections with a score of 0.5 or higher.
--- Input ---
Image: /Users/kiarina/src/github.com/kiarina/labs/assets/jpg/object_detection_desk_scene.png
Resolution: 1536x1024
Threshold: 0.50
--- Detections ---
Rank | Label | Score | BBox xyxy
--------------------------------------------------------
1 | laptop | 0.970 | (177, 116, 910, 690)
2 | cup | 0.965 | (870, 326, 1089, 520)
3 | chair | 0.961 | (5, 80, 543, 446)
4 | bottle | 0.950 | (1122, 74, 1273, 506)
5 | cell phone | 0.947 | (329, 700, 686, 918)
6 | pottedplant | 0.937 | (1302, 2, 1535, 466)
7 | book | 0.916 | (930, 501, 1521, 838)
8 | book | 0.893 | (878, 614, 1519, 962)
9 | diningtable | 0.836 | (0, 240, 1533, 1012)
10 | vase | 0.543 | (1456, 252, 1535, 465)
Detection count: 10
--- Inference Speed Benchmark (Iterations: 20) ---
Average time: 127.60 ms
Min time: 119.11 ms
Max time: 170.92 ms
Std dev: 10.98 ms
The visualization with bounding boxes is shown below.
Interpretation
The detailed data is shown above, but in simpler terms:
The main objects were detected with high scores
The laptop, cup, chair, bottle, cell phone, and books were detected with scores of 0.89 or higher. For an image where the objects are clear and do not overlap heavily, this COCO object detection model worked quite naturally.Background objects were also detected as COCO labels
The plant was detected aspottedplant, part of the pot asvase, and the desk asdiningtable. Rather than treating these as simple mistakes, it seems better to understand them as assignments to the closest available labels in the COCO label set.CPU inference took around 120 ms per run
On an Apple M4 Max CPU, the average inference time was 127.60 ms. This is practical for still-image analysis or low-frequency monitoring. For real-time video across every frame, I would consider GPU inference or reducing the inference frequency.NMS was not included in this test
NMS stands for Non-Maximum Suppression. It is a post-processing step that removes duplicate detections that appear in nearly the same location. It was not a major issue in this image, but more complex scenes may leave duplicate detections without NMS.
Thoughts after verification
The D-FINE ONNX model felt straightforward to use. It was nice to confirm the full flow with compact code: downloading the model, preprocessing the image, running ONNX Runtime inference, mapping boxes back to the original image, and drawing the result.
At the same time, this test only used one generated image. Real photos, darker scenes, smaller objects, and heavy occlusion can change the results. Next, I would like to test stability across multiple real images, compare results with and without NMS, and measure the speed difference with GPU execution.


Top comments (0)