Welcome to Raspberry Pi 5 repository
02.CLI use
CLI Usage
CLI Usage1. Using CLI for Prediction2. CLI Usage Syntax3. Image PredictionEffect Preview4. Video PredictionEffect Preview5. Real-time PredictionReferences
1. Using CLI for Prediction
CLI (Command-Line Interface) is a way for users to interact with computers or software programs, where users run programs or execute tasks by typing text commands instead of clicking icons or buttons through a graphical user interface (GUI).
2. CLI Usage Syntax
xxxxxxxxxxyolo TASK MODE ARGSWhere TASK (optional) is one of [detect, segment, classify, pose, obb]MODE (required) is one of [train, val, predict, export, track, benchmark]ARGS (optional) are any number of custom 'arg=value' pairs like 'imgsz=320' that override defaults.
3. Image Prediction
Use yolo26n.pt to predict the built-in images in the ultralytics26 project: If the system cannot find the corresponding model file in the directory where the command is run, it will be automatically downloaded (if download fails, you can copy the model in yourself)
Enter the project folder:
xxxxxxxxxxcd /home/pi/ultralytics26/
Use yolo26n.pt to detect images in the target folder and output results:
xxxxxxxxxxyolo predict model=yolo26n.pt source='/home/pi/ultralytics26/assets'

Effect Preview
yolo recognition output video location: /home/pi/ultralytics26/runs/detect/predict
Each time it runs, the predict under this folder automatically increments by 1

4. Video Prediction
Use yolo26n.pt to predict videos in the ultralytics project (not videos that come with ultralytics): If the system cannot find the corresponding model file in the directory where the command is run, it will be automatically downloaded (if download fails, you can copy the model in yourself)
Enter the project folder:
xxxxxxxxxxcd /home/pi/ultralytics26
Use yolo26n.pt to detect videos in the target folder and output results:
xxxxxxxxxxyolo predict model=yolo26n.pt source='/home/pi/ultralytics26/videos'

Effect Preview
yolo recognition output video location: /home/pi/ultralytics26/runs/detect/predict2
Each time it runs, the predict under this folder automatically increments by 1
You can use the VLC application pre-installed on Raspberry Pi to view videos


5. Real-time Prediction
Use yolo26n.pt to predict USB camera footage: If the system cannot find the corresponding model file in the directory where the command is run, it will be automatically downloaded (if download fails, you can copy the model in yourself)
Enter the project folder:
xxxxxxxxxxcd /home/pi/ultralytics26
Use yolo26n.pt to detect camera footage and output results: Currently only USB cameras can directly use CLI to predict real-time footage. No relevant information found for directly using CSI cameras as input source
xxxxxxxxxxyolo predict model=yolo26n.pt source=0 save=False show # Object detection# Instance segmentation: yolo predict model=yolo26n-seg.pt source=0 save=False show# Image classification: yolo predict model=yolo26n-cls.pt source=0 save=False show# Pose estimation: yolo predict model=yolo26n-pose.pt source=0 save=False show# Oriented object detection: yolo predict model=yolo26n-obb.pt source=0 save=False show
Click on the terminal and press the "Ctrl + C" shortcut to terminate the program!
Parameter Description
model: Specify the YOLO model
source: Specify the recognition source: multiple cameras can switch numbers
save=False: Disable saving results
show: Real-time display
