Welcome to Raspberry Pi 5 repository
10.Model training - conversion
Model Training_Conversion
After completing the dataset annotation tutorial content, we can use the board to start training the model.
xxxxxxxxxxThis tutorial only introduces CLI model training and conversion. You can refer to the official website for Python case modifications.Due to performance reasons of the Raspberry Pi 5 board, model training takes a long time and requires patience.
1. Model Training
Use CLI commands to directly train the model: Copy the yolo26n.pt file to the configuration file directory, then open a terminal in the configuration file directory:
xxxxxxxxxxcd /home/pi/ultralytics26/data/yahboom_data/orange_data
xxxxxxxxxxyolo detect train data=orange.yaml model=yolo26n.pt epochs=100 imgsz=640
data: Dataset configuration file
model: Pre-trained model file
epochs: Number of training epochs
imgsz: Specify input image size



2. Model Conversion
The final model will be generated in the runs folder: Generally choose the best.pt file for use
xxxxxxxxxx/home/pi/ultralytics26/data/yahboom_data/orange_data/runs/detect/train/weights
Convert pt model to ncnn model:
xxxxxxxxxxcd /home/pi/ultralytics26/data/yahboom_data/orange_data/runs/detect/train/weights
xxxxxxxxxxyolo export model=best.pt format=ncnn


References
Model Training with Ultralytics YOLO - Ultralytics YOLO Documentation