Prepare the Fine‑Tuning Environment
Set up a Python virtual environment, copy necessary scripts and data, and install Ultralytics to fine‑tune the YOLOv11n model.
Fine‑tuning a YOLOv11n model requires a clean Python environment with the Ultralytics framework and your dataset. Follow these steps on a machine with a powerful GPU (not the Raspberry Pi):
bash
# Create and activate a virtual environment in your home directory
cd
python3 -m venv finetune
cd finetune
source bin/activate
# Set up a directory structure for scripts, data and models
mkdir scripts
cp ~/repos/common_platform/scripts/ls_to_yolo.py scripts/
cp ~/repos/common_platform/scripts/make_split_and_yaml.py scripts/
cp ~/repos/common_platform/scripts/prune_images_without_boxes.py scripts/
mkdir -p data/images_raw
cp ~/teleop_data/images/* data/images_raw/
cp -r ~/teleop_data/annotations data/
mkdir models
cp ~/code/common_platform/models/yolo11n.pt models/
mkdir runs
# Install Ultralytics
pip install ultralytics