Welcome to Raspberry Pi 5 repository
10. Model training_conversion
Model training_conversion
After completing the tutorial content of dataset annotation, we can use the motherboard to start training the model.
xxxxxxxxxxThis tutorial only introduces the model training and conversion of CLI. You can refer to the official website to modify the Python caseDue to performance reasons, the model training time of the Raspberry Pi 5 motherboard is relatively long, so you need to wait patiently.
1. Model training
Use CLI commands to train the model directly: Copy the yolo11n.pt file to the directory where the configuration file is located, and then open the terminal in the directory where the configuration file is located:
xxxxxxxxxxcd /home/pi/ultralytics/ultralytics/data/yahboom_data/orange_data
xxxxxxxxxxyolo detect train data=orange.yaml model=yolo11n.pt epochs=100 imgsz=640
data: Dataset configuration file
model: Pre-trained model file
epochs: Number of training rounds
imgsz: Input specified 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/ultralytics/ultralytics/data/yahboom_data/orange_data/runs/detect/train/weights
Convert the pt model to an onnx or ncnn model:
xxxxxxxxxxcd /home/pi/ultralytics/ultralytics/data/yahboom_data/orange_data/runs/detect/train/weights
xxxxxxxxxxyolo export model=best.pt format=onnxyolo export model=best.pt format=ncnn


