ultralytics-segment-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": [
[0, 0, 2, 2, 0.8, 0]
]
},
"masks": {
"data": [
[
[1, 1],
[1, 1]
]
],
"xy": [
[
[0, 0],
[2, 0],
[2, 2],
[0, 2]
]
],
"xyn": [
[
[0, 0],
[1, 0],
[1, 1],
[0, 1]
]
]
},
"names": {
"0": "insect"
},
"orig_shape": [2, 2],
"path": "frame.jpg"
}Convert to a standard format
This format is documented, but a conversion adapter is not yet registered.
General conversion example and required context
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.
Masks: Default mask grid follows the preprocessed inference image, which may include letterbox padding. retina_masks=True uses original-image dimensions. masks.xy and masks.xyn map contours to original pixel and normalized coordinates respectively; they are not the binary mask grid. No predictions sets masks=None.
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.