ML-PIPES-ULTRALYTICS

ml-pipes-ultralytics Index

This page catalogs the public ml_pipes.ultralytics package surface.

For the Ultralytics Model API comparison, see coverage.md. For the package overview and examples, see the repository README.

Public Modules

Module Contents
yolo Predict, Embed, and Track operators, plus the native source and configuration type aliases.
results Operators wrapping configurable native Results methods.

Model Inference

See the upstream Ultralytics Model reference.

Operator Input -> Output Notes
yolo.Predict(model="yolo26n.pt", task=None, verbose=False, **predict_options) Sources -> list[Results] Runs non-streaming native YOLO prediction.
yolo.Embed(model="yolo26n.pt", task=None, verbose=False, **embed_options) Sources -> list[Tensor] Runs non-streaming native YOLO embedding. With no embed option, Ultralytics selects its default embedding layer.
yolo.Track(model="yolo26n.pt", task=None, verbose=False, persist=False, **track_options) Sources -> list[Results] Runs non-streaming native YOLO tracking. persist controls tracker state across calls to the same operator.

Result Operations

results is the module containing the result operators below. See the upstream Ultralytics Results reference.

Operator Input -> Output Notes
results.To(...) Results -> Results Moves native result tensors to a device or dtype.
results.Plot(...) Results -> ndarray \| Image Renders an annotated image.
results.Show(...) Results -> Results Displays an annotated image and passes the result through.
results.ToDataFrame(...) Results -> polars.DataFrame Converts a result to a Polars dataframe.
results.ToCSV(...) Results -> str Converts a result to CSV.
results.ToJSON(...) Results -> str Converts a result to JSON.
results.SaveTXT(...) Results -> Results Writes labels and passes the result through.
results.SaveCrop(...) Results -> Results Writes detected-object crops and passes the result through.
results.Save(...) Results -> Results Saves an annotated image and passes the result through.
results.Summary(...) Results -> list[dict[str, Any]] Converts a result to summary dictionaries.

The argument-less Results methods cpu, numpy, cuda, new, and verbose can be used directly as unbound methods in a pipeline.

Inspection

Importing ml_pipes.ultralytics registers the BGR convention for bare np.ndarray image previews, matching Ultralytics and OpenCV. Inspection converts these previews to RGB without changing the source arrays. Other arrays retain their shape and dtype summaries. Native Results values show text summaries of their predictions.

For pipelines using RGB arrays, override the convention on your inspector:

import numpy as np
from ml_pipes.inspection import PipelineInspector, ndarray_image_formatter

inspector = PipelineInspector().register_value_formatter(
    np.ndarray, ndarray_image_formatter(default_color_space="RGB"), override=True,
)