D-FINE Object Detection Explained: Box Distributions on Video Frames
D-FINE is a real-time object detector from the DETR family. Its distinguishing idea concerns boxes. Instead of predicting four coordinates as single numbers, each decoder layer predicts, for every box edge, a probability distribution over 33 candidate corrections to an initial box, and later layers refine those distributions. The final edge position is the initial one moved by the expected value of that distribution.
Nothing in D-FINE is temporal. AI-Powered Video Analyzer, a local video object detection pipeline, picks frames from a video and runs the detector on each one separately, with no tracking. This article explains the method, then what a score and a box in the analyzer's report can and cannot tell you. Analyzer behaviour refers to version 1.1.0 running VisionServeX 3.23.0, and implementation details to Hugging Face Transformers 5.24.1, all checked on 27 November 2026.
DETR, RT-DETR and D-FINE
Many detectors produce a dense set of overlapping candidates and prune them afterwards with non-maximum suppression (NMS). DETR instead treats detection as set prediction: a fixed set of object queries each predicts one class and one box, and training matches predictions to ground-truth objects one to one with a bipartite (Hungarian) matching. A second query that fires on an already matched object is penalised, so NMS is not part of the design.
RT-DETR adapted this design to real-time use, mainly with a more efficient encoder and a better way of choosing the initial queries. D-FINE builds on that line. It trims and rearranges parts of the network and then adds two components:
- Fine-grained Distribution Refinement (FDR) changes what the box head outputs.
- Global Optimal Localization Self-Distillation (GO-LSD) changes how the model is trained.
| Model | Main idea | How a box is expressed | NMS in the design |
|---|---|---|---|
| DETR | Set prediction with object queries | Four regressed numbers | No |
| RT-DETR | Real-time DETR with a hybrid encoder | Regressed, refined layer by layer | No |
| D-FINE | RT-DETR line plus FDR and GO-LSD | Distributions over edge corrections | No |
The authors' step-by-step ablation for the L size shows how much each part contributes on COCO. Their baseline, RT-DETR-HGNetv2-L, has 53.0 AP. After the architecture and training-strategy changes the model is back at 53.0 AP with fewer GFLOPs. Adding FDR raises it to 53.5, and adding GO-LSD to 54.0.
The path of one sampled frame
From a sampled video frame to detection records
Seven stages in order: the frame is converted to RGB and resized to a 640 pixel square, a backbone and hybrid encoder produce features, a decoder refines 300 queries, edge distributions are decoded to boxes, and the highest scores above a threshold become records without NMS.
| stage | input | output | what happens |
|---|---|---|---|
| 1. Resize and rescale | sampled frame, BGR | tensor [1, 3, 640, 640] in [0, 1] | Converted to RGB and stretched to a square: no padding, no mean or standard deviation normalisation. |
| 2. Backbone (HGNetv2) | tensor [1, 3, 640, 640] | feature maps at strides 8, 16, 32 | A convolutional network extracts features at three scales. |
| 3. Hybrid encoder | three feature maps | fused feature maps | Mixes information within and across the scales. |
| 4. Query selection | encoder features | 300 object queries | In the Transformers implementation the queries start from the 300 encoder positions with the highest class score. |
| 5. Decoder with FDR | 300 queries | class logits and 4 x 33 box logits | 3 layers in the nano and small checkpoints, 4 in medium, 6 in large. Each layer adds residual logits. |
| 6. Decode boxes | initial box and 4 distributions | 300 boxes | Each edge moves by the expected value of its distribution, relative to the initial box size. |
| 7. Select by score | 300 queries x 80 classes | label, score, box records | Keep the 300 highest query-class pairs, then those above 0.3. No non-maximum suppression. |
Stage 1 of 7, Resize and rescale. Input: sampled frame, BGR. Output: tensor [1, 3, 640, 640] in [0, 1].
Because the frame is stretched to a square, a 640 x 360 frame is enlarged vertically by a factor of about 1.78 and not at all horizontally. Boxes are mapped back to the original pixel coordinates afterwards.
Fine-grained Distribution Refinement
A box as four distributions
The first decoder layer predicts an initial box {x, y, W, H}: centre, width and height. From it you get four distances from the centre to the top, bottom, left and right edges, d0 = {t, b, l, r}, so initially t = b = H/2 and l = r = W/2.
A conventional head would now predict corrected numbers. Earlier distribution-based heads such as GFocal predict a discrete distribution over the distances themselves. D-FINE predicts a distribution over corrections to the initial distances. In the paper's notation, for decoder layer l:
d^l = d0 + {H, H, W, W} * sum over n = 0..N of W(n) * Pr^l(n) (paper Eq. 2)
Pr^l(n) = Softmax( Δlogits^l(n) + logits^(l-1)(n) ) (paper Eq. 3)
nindexes the bins,0..N. The preset checkpoints useN = 32, so there are 33 bins.Pr^l(n)stands for four separate distributions, one per edge. The softmax runs over the bins of one edge.W(n)is the correction that binnstands for, as a fraction of the initial box height (top and bottom) or width (left and right).Δlogits^l(n)is the residual that layerlpredicts, added to the logits of the previous layer.
Two details are easy to miss. First, every layer's box is computed from the same initial box. The corrections accumulate in the logits; a layer's box is not the starting point of the next correction, although the Transformers code does pass it on to steer where the next layer attends. Second, corrections scale with box size, so the same distribution shifts a large box by more pixels than a small one.
The weighting function
The bins are not evenly spaced. W(n) is dense near zero and sparse near its ends:
W(0) = -2a
W(n) = c - c * (a/c + 1)^((N - 2n)/(N - 2)) for 1 <= n < N/2
W(n) = -c + c * (a/c + 1)^((-N + 2n)/(N - 2)) for N/2 <= n <= N - 1
W(N) = 2a (paper Eq. 4)
The parameter a sets the reach and c the curvature. The preset checkpoints use a = 0.5 and c = 0.25.
The 33 correction values W(n) of the preset D-FINE checkpoints
Values of the weighting function against the bin number from 0 to 32. The curve passes through zero at bin 16, is nearly flat around it, steepens towards both ends and jumps to minus one and plus one at the last bin on each side.
W(n), values at or above the threshold: 17 of 33 (16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32)
| bin n | W(n) | at or above threshold |
|---|---|---|
| 0 | -1 | none |
| 1 | -0.5 | none |
| 2 | -0.447 | none |
| 3 | -0.398 | none |
| 4 | -0.352 | none |
| 5 | -0.31 | none |
| 6 | -0.27 | none |
| 7 | -0.233 | none |
| 8 | -0.199 | none |
| 9 | -0.167 | none |
| 10 | -0.138 | none |
| 11 | -0.111 | none |
| 12 | -0.085 | none |
| 13 | -0.061 | none |
| 14 | -0.039 | none |
| 15 | -0.019 | none |
| 16 | 0 | W(n) |
| 17 | 0.019 | W(n) |
| 18 | 0.039 | W(n) |
| 19 | 0.061 | W(n) |
| 20 | 0.085 | W(n) |
| 21 | 0.111 | W(n) |
| 22 | 0.138 | W(n) |
| 23 | 0.167 | W(n) |
| 24 | 0.199 | W(n) |
| 25 | 0.233 | W(n) |
| 26 | 0.27 | W(n) |
| 27 | 0.31 | W(n) |
| 28 | 0.352 | W(n) |
| 29 | 0.398 | W(n) |
| 30 | 0.447 | W(n) |
| 31 | 0.5 | W(n) |
| 32 | 1 | W(n) |
Threshold 0. W(n) is at or above it at 17 of 33 (16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32).
So the head has fine steps where small adjustments are needed and a few coarse bins for large mistakes. An edge can move by up to one whole initial box width or height.
A worked example you can run
The following code implements Eqs. 2 to 4 for one box. The logits are made up to show the mechanics; they do not come from a trained model. Edges are ordered left, top, right, bottom, as in the Transformers code (the paper writes top, bottom, left, right).
import numpy as np
N, a, c = 32, 0.5, 0.25 # preset checkpoints
def W_of(n): # Eq. (4) of the paper
if n == 0:
return -2 * a
if n == N:
return 2 * a
if n < N / 2:
return c - c * (a / c + 1) ** ((N - 2 * n) / (N - 2))
return -c + c * (a / c + 1) ** ((-N + 2 * n) / (N - 2))
W = np.array([W_of(n) for n in range(N + 1)])
print("bins:", len(W))
print("W[0,1,8,15,16,17,24,31,32] =", np.round(W[[0, 1, 8, 15, 16, 17, 24, 31, 32]], 4))
def softmax(x):
e = np.exp(x - x.max(axis=-1, keepdims=True))
return e / e.sum(axis=-1, keepdims=True)
def bumps(centres, width): # synthetic logits, one peak per edge
n = np.arange(N + 1)
return np.stack([-0.5 * ((n - m) / width) ** 2 for m in centres])
def decode(initial_box, logits): # Eq. (2); edges: left, top, right, bottom
cx, cy, w, h = initial_box
offsets = softmax(logits) @ W # expected offset per edge, relative units
left, top, right, bottom = np.array([w, h, w, h]) / 2 + np.array([w, h, w, h]) * offsets
return [cx - left, cy - top, cx + right, cy + bottom], offsets
initial = (320.0, 180.0, 200.0, 120.0) # centre x, centre y, width, height (pixels)
deltas = [bumps([19, 16, 14, 18], 5.0), # layer 1: broad
bumps([20, 16, 13, 19], 3.0), # layer 2: residual logits
bumps([20, 16, 13, 19], 2.0)] # layer 3: residual logits
logits = np.zeros((4, N + 1))
print("initial box:", [220.0, 120.0, 420.0, 240.0])
for layer, delta in enumerate(deltas, 1):
logits = logits + delta # Eq. (3): add residual logits, then softmax
box, offsets = decode(initial, logits)
peak = softmax(logits).max(axis=1)
print(f"layer {layer}: box={np.round(box, 1).tolist()} "
f"offsets={np.round(offsets, 3).tolist()} peak_prob={np.round(peak, 2).tolist()}")
Output:
bins: 33
W[0,1,8,15,16,17,24,31,32] = [-1. -0.5 -0.1992 -0.019 0. 0.019 0.1992 0.5 1. ]
initial box: [220.0, 120.0, 420.0, 240.0]
layer 1: box=[204.8, 120.0, 409.9, 246.0] offsets=[0.076, 0.0, -0.05, 0.05] peak_prob=[0.08, 0.08, 0.08, 0.08]
layer 2: box=[203.1, 120.0, 407.9, 247.2] offsets=[0.084, 0.0, -0.06, 0.06] peak_prob=[0.15, 0.16, 0.15, 0.15]
layer 3: box=[203.0, 120.0, 407.8, 247.3] offsets=[0.085, 0.0, -0.061, 0.061] peak_prob=[0.25, 0.25, 0.25, 0.25]
The distributions sharpen from layer to layer while the box settles. Look at the left edge in layer 1: its distribution peaks at bin 19, which stands for 0.061, yet the expected correction is 0.076. Because W grows faster away from zero, the tails of a broad distribution pull the expectation outwards. The edge follows the whole distribution, not its most likely bin.
A broad and a refined distribution over the 33 bins of one edge
Two probability curves over bins 0 to 32. The first layer's curve is wide and low with its peak near bin 19. The third layer's curve is narrow and much higher, concentrated around bin 20.
after layer 1 (circles)after layer 3 (squares, dashed)
after layer 1, values at or above the threshold: 0 of 33
after layer 3, values at or above the threshold: 5 of 33 (18, 19, 20, 21, 22)
| bin n | after layer 1 | after layer 3 | at or above threshold |
|---|---|---|---|
| 0 | 0 | 0 | none |
| 1 | 0 | 0 | none |
| 2 | 0 | 0 | none |
| 3 | 0 | 0 | none |
| 4 | 0.001 | 0 | none |
| 5 | 0.002 | 0 | none |
| 6 | 0.003 | 0 | none |
| 7 | 0.004 | 0 | none |
| 8 | 0.007 | 0 | none |
| 9 | 0.011 | 0 | none |
| 10 | 0.016 | 0 | none |
| 11 | 0.022 | 0 | none |
| 12 | 0.03 | 0 | none |
| 13 | 0.039 | 0 | none |
| 14 | 0.049 | 0 | none |
| 15 | 0.058 | 0.002 | none |
| 16 | 0.067 | 0.012 | none |
| 17 | 0.074 | 0.047 | none |
| 18 | 0.078 | 0.122 | after layer 3 |
| 19 | 0.08 | 0.215 | after layer 3 |
| 20 | 0.078 | 0.252 | after layer 3 |
| 21 | 0.074 | 0.198 | after layer 3 |
| 22 | 0.067 | 0.104 | after layer 3 |
| 23 | 0.058 | 0.037 | none |
| 24 | 0.049 | 0.009 | none |
| 25 | 0.039 | 0.001 | none |
| 26 | 0.03 | 0 | none |
| 27 | 0.022 | 0 | none |
| 28 | 0.016 | 0 | none |
| 29 | 0.011 | 0 | none |
| 30 | 0.007 | 0 | none |
| 31 | 0.004 | 0 | none |
| 32 | 0.003 | 0 | none |
Threshold 0.1. after layer 1 is at or above it at 0 of 33. after layer 3 is at or above it at 5 of 33 (18, 19, 20, 21, 22).
If you read the Transformers source, you will see the same arithmetic written differently. It stores the weighting table multiplied by reg_scale (4 in these checkpoints, so it runs from -4 to 4) and divides box width and height by reg_scale when decoding. The factors cancel. On the example above, the NumPy code and the library's weighting_function and distance2bbox give the same box to floating-point precision.
What exists only during training
The Fine-Grained Localization loss applies cross-entropy to the two bins on either side of the true correction, weighted by how close each is and by the prediction's IoU. GO-LSD uses the final layer's distributions as soft targets for the earlier layers, using the union of the matches found at all layers. Neither adds anything to inference; in the ablation, adding GO-LSD leaves parameters, GFLOPs and latency unchanged.
What a detection score means
Each query produces one logit for each of the 80 classes, and each logit goes through its own sigmoid. The scores are not a softmax, so they need not sum to one across classes.
The Transformers implementation also adds a localisation quality estimate. For each query it takes the four largest probabilities of each edge distribution, and their mean, passes these 20 numbers through a small network, and adds the single output to all 80 class logits of that query. The score therefore mixes "what is it" with "how concentrated are the edge distributions".
Postprocessing then takes the 300 highest of the 300 x 80 query-class pairs and drops those below the threshold.
Two consequences matter when you use the analyzer:
- The effective threshold floor is 0.3. The analyzer does not pass your threshold into the model call, which keeps its default of 0.3, and only then applies
--confidence. Values below 0.3 have no effect in version 1.1.0 (checked 27 November 2026): a run with--confidence 0.1produced output identical to 0.3. - A score is not a measured probability of being correct. No calibration has been measured for this pipeline. Treat 0.6 as higher than 0.4 from the same model, not as "right 60 percent of the time".
No NMS does not mean one box per object
Neither the model design nor the call path used by the analyzer applies NMS. Here is what that looks like in a real run of the balanced preset on a 9 second test clip made from three public-domain and CC0 photographs.
On the first frame, the report contains bowl with score 0.5727 and clock with score 0.4821, both with exactly the box [159.3, 154.0, 428.4, 356.0]. That box outlines the metal neck ring of a pressure suit. Both labels are wrong, and no COCO class would be right. Because selection runs over query-class pairs, one query can be reported under two labels.
On a frame showing one espresso cup and one spoon, the same run reports:
| Label | Score | IoU with the top spoon box | What the box covers (checked by eye) |
|---|---|---|---|
| spoon | 0.739 | 1.000 | the spoon |
| cup | 0.719 | 0.277 | the cup |
| spoon | 0.578 | 0.997 | the spoon again |
| spoon | 0.487 | 0.000 | cup handle and part of the cup |
| spoon | 0.468 | 0.000 | cup handle |
| bowl | 0.405 | 0.233 | upper part of the cup |
| spoon | 0.390 | 0.428 | lower end of the spoon |
| diningtable | 0.867 | 0.157 | the wooden table, whole frame |
The label spoon appears five times for one spoon. Class-aware NMS applied afterwards at an IoU threshold of 0.5 would remove only the 0.578 box from this frame: the two boxes on the cup handle do not overlap the best spoon box at all, and suppression cannot repair a wrong label. It would also keep the identical bowl and clock pair, because their classes differ. Class-agnostic NMS at 0.5 would drop that clock, and on the coffee frame the bowl on the cup as well. Do not read per-class counts as object counts.
The "no NMS" statement applies to the path described here. Another runtime that loads D-FINE can add its own postprocessing.
IoU, precision, recall and AP
Intersection over Union compares two boxes: the area they share divided by the area they cover together.
IoU(A, B) = area(A ∩ B) / area(A ∪ B)
IoU of a reference box and a predicted box
Two overlapping rectangles, a solid reference box and a dashed predicted box shifted to the right and down. Their intersection is filled and the intersection area, union area and IoU are listed.
A: reference (solid)B: prediction (dashed)intersection
| quantity | value |
|---|---|
| area of reference(x2 − x1)(y2 − y1) | 2500 |
| area of prediction(x2 − x1)(y2 − y1) | 2600 |
| intersectionoverlap width × overlap height | 1760 |
| unionarea A + area B − intersection | 3340 |
| IoUintersection / union | 0.5269 |
| Dice2 × intersection / (area A + area B) | 0.6902 |
This IoU reaches the threshold 0.5 (a match needs IoU at or above it).
Intersection 1760, union 3340: IoU 0.5269, Dice 0.6902.
Confidence and IoU answer different questions. The score comes from the model alone; IoU needs a ground-truth box that you drew or obtained elsewhere.
A confident box can be loose, and a doubtful box can be tight
For four predictions A to D, confidence and IoU with the true box are plotted side by side. A is high on both, B is confident but poorly placed, C is doubtful but well placed, and D is low on both.
confidence (circles)IoU with truth (squares, dashed)
confidence, values at or above the threshold: 2 of 4 (A, B)
IoU with truth, values at or above the threshold: 2 of 4 (A, C)
| prediction | confidence | IoU with truth | at or above threshold |
|---|---|---|---|
| A | 0.95 | 0.92 | confidence, IoU with truth |
| B | 0.9 | 0.38 | confidence |
| C | 0.45 | 0.88 | IoU with truth |
| D | 0.35 | 0.2 | none |
Threshold 0.5. confidence is at or above it at 2 of 4 (A, B). IoU with truth is at or above it at 2 of 4 (A, C).
To evaluate a detector, process predictions of a class from the highest score down. A prediction is a true positive (TP) if its IoU with a not-yet-matched true box reaches the chosen threshold, and a false positive (FP) otherwise. True boxes left without a match are false negatives (FN). Then precision = TP / (TP + FP) and recall = TP / (TP + FN). Average precision (AP) is the area under the interpolated precision-recall curve of one class. The COCO "AP" averages over 80 classes and over ten IoU thresholds from 0.50 to 0.95, sampling 101 recall levels.
The code below treats the four hypothetical predictions as detections of one class with three true objects, and simplifies matching by assuming that no two predictions compete for the same true object:
import numpy as np
predictions = [(0.95, 0.92), (0.90, 0.38), (0.45, 0.88), (0.35, 0.20)] # (score, IoU)
n_true = 3 # simplification: no two predictions share a true box
def ap_101(threshold):
hits = np.array([iou >= threshold for _, iou in sorted(predictions, reverse=True)])
tp, fp = np.cumsum(hits), np.cumsum(~hits)
precision, recall = tp / (tp + fp), tp / n_true
levels = np.linspace(0, 1, 101)
return np.mean([precision[recall >= r].max() if (recall >= r).any() else 0.0
for r in levels])
for t in (0.5, 0.75, 0.9, 0.95):
print(f"IoU threshold {t:.2f}: AP = {ap_101(t):.3f}")
IoU threshold 0.50: AP = 0.554
IoU threshold 0.75: AP = 0.554
IoU threshold 0.90: AP = 0.337
IoU threshold 0.95: AP = 0.000
AP falls as the threshold demands tighter boxes. That is why a method that improves box placement, as FDR aims to, shows up in AP averaged over thresholds. The analyzer computes none of these metrics and has no evaluation against ground truth.
The presets in the analyzer
--preset |
Model id | Hugging Face checkpoint (ustc-community/…) |
Training data | Decoder layers | Params / GFLOPs | AP val | T4 latency |
|---|---|---|---|---|---|---|---|
fast |
dfine-n |
dfine-nano-coco |
COCO | 3 | 4M / 7 | 42.8 | 2.12 ms |
balanced (default) |
dfine-s |
dfine-small-obj2coco |
Objects365, then COCO | 3 | 10M / 25 | 50.7 | 3.49 ms |
quality |
dfine-m |
dfine-medium-obj2coco |
Objects365, then COCO | 4 | 19M / 57 | 55.1 | 5.62 ms |
quality+ |
dfine-l |
dfine-large-obj2coco-e25 |
Objects365, then COCO | 6 | 31M / 91 | 57.3 | 8.07 ms |
The columns to the right of the layer count come from the authors' model zoo: AP on COCO val2017, with latency on a T4 GPU using TensorRT in half precision. The analyzer runs PyTorch and Transformers in full precision, so do not expect those times.
Read the preset ladder with care:
- Only
dfine-nis trained on COCO alone. The other three were pretrained on the larger Objects365 dataset, so comparing presets mixes model size with training data. The authors list COCO-only small, medium and large models at 48.5, 52.3 and 54.0 AP. qualityis not the highest-accuracy D-FINE. The large and extra-large models score higher in the authors' table.- D-FINE code is Apache-2.0, but its README warns that
obj2cococheckpoints may be subject to Objects365 dataset terms and should not be assumed to be commercially cleared. That covers three of the four presets. This is not legal advice.
On the nine frames sampled from the test clip, with the threshold at 0.3, the four presets reported:
| Preset | Detections | With score 0.5 or more |
|---|---|---|
fast |
64 | 29 |
balanced |
34 | 21 |
quality |
21 | 15 |
quality+ |
25 | 17 |
These are three still pictures with a slow pan and no ground truth. The table shows that presets disagree; it does not rank their accuracy.
Running the detector alone
git clone https://github.com/arashsajjadi/ai-powered-video-analyzer.git
cd ai-powered-video-analyzer
python -m pip install -e ".[vision]" torch transformers
ai-video-analyzer analyze video.mp4 --preset balanced \
--no-captioning --no-audio-events --no-summarization -o results
Name torch and transformers explicitly. In version 1.1.0 (checked 27 November 2026), the documented .[vision] extra alone installed neither: every frame failed, the report had zero detections and the command still exited with status 0. Speech transcription has no off switch and runs if Whisper and moviepy happen to be installed. The --device flag affects only the detector, and the report does not record which device was used.
Which frames reach the detector is a separate decision with its own failure modes, covered in how AI analyzes an entire video.
For measured CPU and GPU times of the four presets, see the D-FINE CPU versus GPU benchmark.
D-FINE compared with YOLO and RT-DETR
These rows are from Table 1 of the D-FINE paper: large-size models on COCO val2017, latency measured end to end with TensorRT FP16 on a T4 GPU. They are the D-FINE authors' own comparison, not an independent one, and the analyzer repository contains no YOLO comparison. The paper's "NMS tuned" row uses a confidence threshold of 0.01 for NMS.
| Model | NMS-free (paper's grouping) | Params | GFLOPs | Latency (ms) | AP val |
|---|---|---|---|---|---|
| YOLOv8-L | No | 43M | 165 | 12.31 | 52.9 |
| YOLOv9-C | No | 25M | 102 | 10.66 | 53.0 |
| YOLO11-L | No | 25M | 87 | 10.28 | 53.4 |
| YOLO11-L, NMS tuned | No | 25M | 87 | 6.31 | 52.9 |
| YOLOv10-L | Yes | 24M | 120 | 7.66 | 53.2 |
| RT-DETR-HG-L | Yes | 32M | 107 | 9.25 | 53.0 |
| D-FINE-L | Yes | 31M | 91 | 8.07 | 54.0 |
D-FINE-L has the highest AP in this selection but not the lowest latency. Note also how much the YOLO11 latency depends on the NMS settings. Before choosing, repeat the comparison on your own hardware, input size and classes, and check each project's licence.
What the label list cannot say
All four presets output the 80 COCO classes, with a few older spellings. Filter code must use these exact strings:
| Report string | Common name |
|---|---|
motorbike |
motorcycle |
aeroplane |
airplane |
sofa |
couch |
pottedplant |
potted plant |
diningtable |
dining table |
tvmonitor |
TV or monitor |
There is no class for fire, smoke or weather. The classification head has 80 outputs, so on a burning building the detector can only stay silent about the fire or attach one of those 80 names to something. A benchmark record in the public repository for a clip described as fire lists person, cake, bird, sandwich and pizza labels; that clip is not published, so the record cannot be checked. If you need other categories, you need a model trained for them or an open-vocabulary detector, with its own evaluation.
Other limits worth building into your code:
- Boxes are not clipped to the image. In the test runs, x ranged from -0.2 to 640.6 on 640 pixel wide frames. Clip before cropping.
- Detections belong to sampled frames. There is no tracking, and short events between samples are never seen.
- The captioning stage writes separate sentences about frames. It does not check, change or correct detector output.
What a caption can add beside these labels, and where it goes wrong, is shown in BLIP captions on video frames.
Inspecting a D-FINE model interactively
If you want to look at boxes on your own images without writing code, Anastig Vision Lab can run a D-FINE-N model in the browser without signing in, with a 640 x 640 input, COCO classes and boxes only. Anastig is a separate platform: it is not part of the analyzer, does not read its reports, and its browser build should not be assumed to give identical boxes. Disclosure: the author of this article is also involved in building Anastig.
Summary
D-FINE keeps the DETR idea of predicting a set of objects from queries and changes how each box is placed: four distributions of corrections, refined across decoder layers, collapsed to an expectation. In practice, read a score as a ranking value rather than a probability, expect duplicate and doubly labelled boxes because nothing removes them, measure localisation against your own ground truth, and remember that the model can only name what is in its 80-class list.
References
- Y. Peng, H. Li, P. Wu, Y. Zhang, X. Sun, F. Wu. D-FINE: Redefine Regression Task in DETRs as Fine-grained Distribution Refinement. ICLR 2025. arXiv:2410.13842
- D-FINE official repository, model zoo and licence note. github.com/Peterande/D-FINE
- N. Carion, F. Massa, G. Synnaeve, N. Usunier, A. Kirillov, S. Zagoruyko. End-to-End Object Detection with Transformers. arXiv:2005.12872
- Y. Zhao, W. Lv, S. Xu, J. Wei, G. Wang, Q. Dang, Y. Liu, J. Chen. DETRs Beat YOLOs on Real-time Object Detection. arXiv:2304.08069
- Hugging Face Transformers, D-FINE documentation. huggingface.co/docs/transformers/model_doc/d_fine
- Hugging Face Transformers 5.24.1,
modeling_d_fine.py. Source file - COCO detection evaluation metrics. cocodataset.org
- A. Sajjadi. AI-Powered Video Analyzer, source repository, version 1.1.0. GitHub