Als Markdown anzeigen

libreyolo track

Runs model.track() over a video file, an image directory or an image list and prints one line per frame with that frame's track IDs. New in 1.8.0, and it works with checkpoints and exported artifacts alike.

Command
libreyolo track
Required
source
Output
One line per frame on stdout. With save=true, an annotated video under runs/track/

Synopsis

bash
libreyolo track source=<video|directory|image|a.jpg,b.jpg> [model=<name|path>] [key=value ...]

Arguments are key=value pairs, and POSIX form works too, so tracker=botsort and --tracker botsort are the same argument.

Arguments

ArgumentDefaultMeaning
sourceVideo file, image directory, image path, or a comma-separated a.jpg,b.jpg image list. Required
modelyolox-sModel name or path; an exported artifact works too
trackerbytetrackbytetrack, botsort, ocsort or deepocsort. The .yaml spellings select the same built-in trackers
track_conf0.25Confidence threshold of the tracker's first association stage
confDetection threshold. Unset, the detector runs at the tracker's own low threshold so weak boxes stay available for recovery
iou0.45NMS IoU threshold
imgszInput image size: 640 (square) or 480x640 (HxW). The model's own input size when unset
classesFilter by class IDs, e.g. [0,2,5]. A bare integer is accepted
max_det300Max detections per frame
savefalseSave the annotated video
showfalseDisplay tracked frames; q stops
vid_stride1Process every N-th frame
fps30Frame rate assumed for image sequences; ignored for videos
output_pathOutput video path. Default runs/track/<name>.mp4, numbered so a run never overwrites another
color_formatautoInput color: auto, rgb, bgr
deviceautoDevice: 0, cpu, mps, auto
jsonfalseJSON output to stdout, one object per frame
quietfalseSuppress stderr
verbosefalseVerbose stderr output
help_jsonfalseDump command schema as JSON and exit

Examples

Basic
libreyolo track model=LibreYOLO9s.pt source=video.mp4
Another tracker, saved video
libreyolo track model=LibreYOLO9s.pt source=video.mp4 \  tracker=botsort classes="[0]" save=true
Exported model, JSON per frame
libreyolo track model=weights/LibreYOLO9s.onnx source=frames/ fps=25 \  json=true quiet=true

Notes

Each invocation tracks one source from its first frame, so there is no persist option: track IDs never carry over between commands. Live sources are rejected with config_unsupported: webcams and streams. Use a video file, an image directory or an image list.

The human output is one line per frame, such as frame 12 video.mp4: 1920x1080 3 tracks (ids 1, 2, 5), and stderr ends with the frame count and the number of unique track IDs. With json=true, each frame is one JSON object carrying tracker, frame_index and a detections list in which every box has track_id, class, class_id, confidence and bbox_xyxy.

A model whose task has no boxes to associate, or a model type without track(), exits with config_unsupported. Exit codes follow libreyolo predict: 0 on success, 2 for a usage or configuration error, 3 when the source cannot be found, 4 when the model cannot be loaded, and 1 for other runtime failures.

The trackers, their configs and the Python track() call are covered in object tracking.

Mit LibreYOLO v1.8.0 verifiziert.