ultralytics-detect-results

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

Readable projection of one Python Results object, not an author JSON export. boxes.data rows are pixel x1,y1,x2,y2,confidence,class. Real names mappings use integer keys. The segmentation example uses a tiny 2 × 2 image and mask to show nesting.

Example

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

Readable projection: arrays and objects below illustrate the contents. The author returns Python objects/tensors or files, rather than this JSON document.

{
  "boxes": {
    "data": [
      [10, 20, 50, 60, 0.8, 0]
    ]
  },
  "names": {
    "0": "insect"
  },
  "orig_shape": [100, 200],
  "path": "frame.jpg"
}

Convert to a standard format

Use Converter.convert with source="ultralytics-detect-results" 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-results

How to interpret it

Scope: Relevant public prediction fields of Results, not a JSON serialization or a complete inventory of object attributes. Batched prediction returns a list; stream=True returns a generator.

Coordinates: boxes.data uses original-image pixel corners; orig_shape is (height, width). Class index meanings come from names.

Box columns: x1, y1, x2, y2, confidence, class; tracking inserts track_id between y2 and confidence. IDs are numeric entries in the tensor, not separate integer arrays.

Empty: boxes.data has zero rows for no detections.

Representation: Arrays describe tensor/ndarray dimensions, and objects describe public attributes. Actual values remain Python objects, tensors and arrays, not JSON. names is a dictionary mapping integer class indices to strings.

Source definitions