Results & Boxes¶
DFINE.predict returns a list of Results (one per image); each holds the detected
Boxes (original-scale xyxy), with .plot()/.save() and interop converters
(to_pandas/to_coco/to_supervision).
dfine.results.Results ¶
Detections for one image + helpers to visualize them.
Source code in dfine/results.py
plot ¶
Draw boxes+labels on a copy of the image; return an RGB HWC uint8 array.
When the boxes carry track ids (boxes.id), each label is prefixed with
#<id> and boxes are colored by track id so an object keeps its color.
Instance masks (self.masks), when present, are overlaid semi-transparently
in each detection's color before boxes/labels are drawn on top.
Source code in dfine/results.py
save ¶
Render via :meth:plot and write to filename; return the path.
to_pandas ¶
Return detections as a pandas.DataFrame (one row per box).
Columns xmin, ymin, xmax, ymax, confidence, class, name — the
ultralytics .pandas().xyxy[0] layout. An empty Results yields an
empty frame that still carries those columns. Requires pandas.
Source code in dfine/results.py
to_coco ¶
Detections as COCO-format result dicts (the loadRes layout).
Each box becomes {"image_id", "category_id", "bbox": [x, y, w, h],
"score"} with the bbox in COCO xywh (top-left + size, original-image
pixels). category_id is the contiguous class id this library predicts;
pass image_id to tag the detections with a dataset image id. Pure
Python — no extra dependency.
Source code in dfine/results.py
to_supervision ¶
Convert to a supervision.Detections (xyxy/confidence/class_id).
Boxes are the original-scale xyxy corners (float32); class ids are the
contiguous labels. Instance masks (when present) are attached as a bool
[N, H, W] mask array. Requires the supervision package.
Source code in dfine/results.py
dfine.results.Boxes ¶
Detected boxes for one image: xyxy (pixels), conf, cls.
id holds per-box track ids when the boxes came from a tracker (e.g.
:meth:DFINE.predict_video with track=True); it is None otherwise.