-
Notifications
You must be signed in to change notification settings - Fork 0
Predict
In computer vision processing, the first phase culminates with detection of objects in the input. This processing results in the prediction, or inference, of the objects. In YOLO terminology, this phase is the Predict mode. The processing speed intrinsic to the algorithms used is well suited for real-time analysis of data from diverse sources, such as:
- Monitoring
- Manufacturing
- Sports
- Safety
The key benefits of the Predict mode in YOLO are:
- Flexibility: a very wide range of input data sources are supported
- Responsiveness: the real-time performance of the solutions
- User friendliness: one can truly hit the ground running with the starter examples in Python and CLI not just for evaluation but for deployment too
- Customization: a very rich set of parameters are available to refine the output of the results for analysis and display
It is not eye candy!
YOLO supports:
- Diverse data sources
- Batch processing
- Streaming
- API for 3rd party integration: see Roboflow
This example is a no-frills demonstration to ensure that the installation of YOLO11 and supporting packages work as expected. The simplest example requires only three statements:
- Import the Ultralytics package (for YOLO interfaces)
- Select a pre-trained model (from Ultralytics)
- Perform the basic detection and inference using an image
- Any image with potential objects whose labels exist in COCO work best, but the bus.jpg image is best to get a feel of the processing elapsed times
The results from model inference are returned in the Results object.
Source bus.jpg Shape (1, 3, 640, 480): 640 x 480 pixels resolution, RGB channels, single image
- Raspberry Pi 5 Model B Rev 1.0
- 4 GB RAM
- Debian GNU/Linux 12 (bookworm) aarch64
The runs, for demonstration purposes, were conducted using
- Python script, helloyolo11.py
- Command Line Interface, CLI, helloyolo11.sh
The code for both sets of runs was identical to that published by Ultralytics. This repository retains both sets as source code.
All timings are expressed in milliseconds. The only change to the script for the runs was the model name that is tabulated below without the file type extension (viz. pt for pretrained)
Model | Preprocess | Inference | Postprocess | Detections |
---|---|---|---|---|
yolov8n | 7.8 | 573.2 | 2.0 | 4 persons, 1 bus, 1 stop sign |
yolo11n | 6.8 | 517.7 | 3.0 | 4 persons, 1 bus |
yolo11s | 7.3 | 1,141.0 | 1.9 | 4 persons, 1 bus |
yolo11m | 6.7 | 2,952.1 | 1.9 | 4 persons, 1 bus |
yolo11l | 6.7 | 3,903.0 | 2.5 | 4 persons, 1 bus |
yolo11x | 6.6 | 7,849.6 | 2.0 | 4 persons, 1 bus |
The basic command to predict using the experimental pretrained model, yolo11x.pt, is:
yolo detect predict model=yolo11x.pt source='https://ultralytics.com/images/bus.jpg'
Alternatively, for comparison purposes, all models were run in a single bash script file.
(venv) chowkidar@raspbari42:~/PycharmProjects/yolov11/predict $ ./helloyolo11.sh
Model | Preprocess | Inference | Postprocess | Detections |
---|---|---|---|---|
yolov8n | 11.2 | 874.8 | 3.3 | 4 persons, 1 bus, 1 stop sign |
yolo11n | 6.8 | 460.7 | 1.9 | 4 persons, 1 bus, |
yolo11s | 6.6 | 1,087.1 | 1.9 | 4 persons, 1 bus |
yolo11m | 6.4 | 2,923.9 | 2.0 | 4 persons, 1 bus |
yolo11l | 6.4 | 3,637.1 | 2.0 | 4 persons, 1 bus |
yolo11x | 6.6 | 7,288.3 | 2.1 | 4 persons, 1 bus |
Keep on learning!