# YOLOv12 Object Detection Training Guide This guide provides instructions for training an object detection model using YOLOv12. The example below demonstrates how to fine-tune the YOLOv12n model. Pre-trained checkpoints are available for download from the Ultralytics Releases page. You can see more at this URL: [Ultralytics Releases](https://github.com/ultralytics/assets/releases) ## Prerequisites - Ensure you have the Ultralytics YOLO package installed. - Download the desired YOLOv12 model checkpoint (e.g., yolo12n.pt) using the provided script. ## 1 Downloading Pre-trained Models To download YOLOv12 model checkpoints, run the following command: ```bash python scripts/download_yolo_model.py \ --url \ --output-dir ``` This will save the pre-trained weights to the ./ckpts/raw/ directory. ## 2 Process Dataset Here is the CLI command to download and process datasets. ```bash python scripts/download_and_process_datasets.py \ --output-dir \ --dataset-base-dir \ --config \ --platforms \ # e.g., ["kaggle", "roboflow", "huggingface"] --roboflow-api-key # Optional: required if "roboflow" is included in --platforms ``` For example: ```bash python scripts/download_and_process_datasets.py \ --output-dir ./datasets/yolo_standard_dataset \ --dataset-base-dir ./datasets/all_datasets \ --config ./config/dataset_config.yaml \ --roboflow-api-key YOUR_ROBOFLOW_APIKEY \ --platforms "kaggle" "roboflow" "huggingface" # e.g., ["kaggle", "roboflow", "huggingface"] ``` For help: ```bash python scripts/download_and_process_datasets.py -h ``` ## 3 Fine-Tuning the Model To fine-tune a YOLOv12 model for object detection, use the provided training script with customizable parameters. Run the following command and adjust the arguments based on your requirements: ```bash yolo detect train \ model= \ data= \ epochs= \ batch= \ patience= \ imgsz= \ lr0= \ lrf= \ device= \ project= \ name= \ save= \ resume= ``` ### Example Configuration For reference, the equivalent configuration using the yolo CLI command is shown below: ```bash yolo detect train \ model="./ckpts/raw/yolo12n.pt" \ data="./datasets/yolo_standard_dataset/data.yaml" \ epochs=100 \ batch=32 \ patience=20 \ imgsz=640 \ lr0=0.01 \ lrf=0.001 \ device=0 \ project="./ckpts/finetune/runs" \ name="license_plate_detector" \ save=true \ resume=false ``` ### More Configurations Run this CLI command to show `Help`. ```bash yolo --help ``` ## Using PaddleOCR