Skip to content

basic_predict

Matha Goram edited this page Nov 14, 2024 · 5 revisions

NAME

basic_predict.py - run a basic YOLO11 Predict Mode for object inference

SYNOPSIS

python basic_predict.py

DESCRIPTION

This Python script performs the following steps:

  • Imports the Ultralytics YOLO package
  • Defines the pretrained model for object inference
  • Specifies the input data for object inference
  • Returns the results after processing by YOLO11

boxes

A Boxes object containing the detection bounding boxes.

masks

A Masks object containing the detection masks.

keypoints

A Keypoints object containing detected keypoints for each object.

probs

A Probs object containing probabilities of each class for classification task. The labels are from COCO:
5 - bus
0 - person

obb

An OBB object containing oriented bounding boxes. Must use a model that provides OBB support.

names

The labels used in Common Object in Context, COCO, to classify the images. Note that the index starts at zero.
{0: 'person', ... 79: 'toothbrush'}

ENVIRONMENT

A list of all environment variables that affect the program or function and how they affect it.

FILES

A list of the files the program or function uses, such as configuration files, startup files, and files the program directly operates on.

STANDARDS

A description of any standards or conventions that relate to the function or command. Commonly just a list of standards.

HISTORY

Adapted from the Ultralytics website.

NOTES

Miscellaneous notes.

CAVEATS

n/a

BUGS

n/a

EXAMPLES

$ python basic_predict.py

AUTHORS

armw

SEE ALSO

Model Prediction with Ultralytics YOLO
ultralytics/engine/results.py

OPTIONS

A description of the command-line options accepted by a program and how they change its behavior.

EXIT STATUS

The normal termination message for the script is:
Process finished with exit code 0

LIBRARY

  • Python packages:
  • os - operating system functions (used here to split fully qualifed filenames)
  • Ultralytics - YOLOv8 or later
  • Python interpreter - 3.11 or later

ERRORS

n/a

VERSIONS

There are no explicit versions of this script. The repository contains trackable commits, pushes and merges.