This service automates the process of training Ultralytics YOLO models using datasets stored in Google Drive. It continuously monitors a specified Google Drive folder for new datasets, downloads them, initiates training, and syncs the training results back to Google Drive.
- Monitoring: Continuously checks a designated Google Drive folder for new datasets
- Download: When a new dataset is detected, it's downloaded to the local machine
- Training: Automatically starts YOLO training on the downloaded dataset
- Synchronization: Training results and model logs are synced back to Google Drive in real-time
- Simultaneous Training: It can run multiple training processes simultaneously, but only on different GPUs
- Python 3.10+
- rclone configured with Google Drive access
- Ultralytics installed
- ONNX in order to export trained models to ONNX format
-
Clone this repository:
git clone https://github.com/santapo/ultralytics-gdrive-ops.git cd ultralytics-gdrive-ops -
Install the required dependencies:
pip install -r requirements.txt
-
Configure rclone for Google Drive access:
rclone config
The training manager expects datasets in a specific structure:
-
Create a ZIP file containing your dataset with the following structure:
dataset_name/ ├── train/ │ ├── images/ │ │ ├── image1.jpg │ │ ├── image2.jpg │ │ └── ... │ └── labels/ │ ├── image1.txt │ ├── image2.txt │ └── ... └── val/ │ ├── images/ │ │ ├── image1.jpg │ │ ├── image2.jpg │ │ └── ... │ └── labels/ │ ├── image1.txt │ ├── image2.txt │ └── ... ├── labels.txt ├── data.yaml └── training_config.yaml -
Ensure your label files follow the YOLOv8 format:
class_id x_center y_center width heightWhere all values are normalized between 0 and 1.
-
The training config file should be a YAML file with the following structure:
model: yolov8x.pt # can be a ultralytics pretrained model or your own model checkpoints stored in gdrive_pretrained_model_path
epochs: 100
batch: 16
... # other training parameters that ultralytics supportsRun the training manager with the following command:
bash run.sh
To tracking trainings with Weight & Bias:
export WANDB_API_KEY=<your_wandb_api_key>
yolo settings wandb=true # to ensure wandb is enabled
