ultralytics-detect-txt

All format examples · Machine-readable schema · Convert outputs to COCO

Class 0, normalized center (0.15,0.4), size (0.2,0.4), confidence 0.8. Explicit settings: save_conf=True, no tracking, YOLOv5 save_format=0. On a 200 × 100 image this is pixel box [10,20,50,60]. YOLOv7 segmentation TXT contains boxes only.

Example

Illustrative values, not predictions from a model. Unless stated otherwise, the image is 200 pixels wide and 100 pixels high.

0 0.15 0.4 0.2 0.4 0.8

Convert to a standard format

Use Converter.convert with source="ultralytics-detect-txt" and target="coco". Your application supplies the predictions and any required image context or producer settings. The adapter validates whether the output contains the information the target needs.

General conversion example and required context

Inspect the intermediate representation for this example

This developer example prints ISIR, the internal representation used between adapters. Run from the repository checkout; no model download is needed.

python3 examples/formats/to_isir.py ultralytics-detect-txt

How to interpret it

Coordinates: Box center and size, divided by original image width/height respectively.

Columns: class, x_center, y_center, width, height, confidence (only with save_conf), track_id (only for tracking results)

Confidence: Confidence is included only with save_conf; a tracking ID, when present, follows it.

Classes: Zero-based model class index. Class meanings require the producing model class-name mapping, which is not embedded.

Tracking: Tracking appends an integer track_id after the optional confidence. A sixth detection column can therefore be confidence OR track_id; the producer options must be known.

Metadata: No image dimensions, image path or class names in each row. Keep source-image association externally.

Source definitions