AI Notebooks - Tutorial - Train YOLOv5 on a custom dataset
How to train the YOLOv5 model on a custom dataset with AI Notebooks
How to train the YOLOv5 model on a custom dataset with AI Notebooks
Last updated 10th March, 2023.
The purpose of this tutorial is to show how it is possible to train YOLOv5 to recognize objects. YOLOv5 is an object detection algorithm. Although closely related to image classification, object detection performs image classification on a more precise scale. Object detection locates and categories features in images.
It is based on the YOLOv5 open source repository by Ultralytics.
If you want to upload it from the OVHcloud Control Panel, go to the Object Storage section and create a new object container by clicking Object Storage
> Create an object container
.
If you want to run it with the CLI, just follow this guide. You have to choose the region, the name of your container and the path where your data is located and use the following command:
ovhai data upload <region> <container> <paths>
This tutorial has been realized with the COCO dataset. If you don't have your own dataset, you can use it by downloading the COCO version "YOLOv5 PyTorch" available for free on Roboflow.
You need to attach a volume if your data is in your OVHcloud object storage and you want to use it during your experiment, or if you need to save the results of your work in the object storage. For more information on data, volumes and permissions, see our guide on data.
If you want to launch it from the OVHcloud Control Panel, just follow this guide.
Name your notebook
Choose Jupyterlab editor
Select the PyTorch framework
Choose the access type
Select the datacenter location (same region as your object container)
Choose the number of GPUs or CPUs you need
For this tutorial, we advise you to use at least 2 GPUs.
Attach Object Storage containers
In this tutorial, you need 2 object containers.
data.yaml
file.Once the repository has been cloned, find the YOLOv5 notebook by following this path: ai-training-examples
> notebooks
> computer-vision
> object-detection
> miniconda
> notebook_object_detection_yolov5.ipynb
.
Attach public ssh keys only if you want to
Check that everything is ok and launch your notebook
If you want to launch it with the CLI, choose the volumes you want to attach and the number of GPUs (<nb-gpus>
) to use on your notebook and use the following command:
ovhai notebook run pytorch jupyterlab \
--name <name> \
--gpu <nb-gpus> \
--volume <dataset-container>@<region>/:/workspace/data:<permission> \
--volume <weights-container>@<region>/:/workspace/models_train:<permission>
You can then reach your notebook’s URL once it is running.
You should have this overview:
Once your dataset is ready and uploaded, you are able to train the YOLOv5 model of your choice!
A preview of this notebook can be found on GitHub here.
Please send us your questions, feedback and suggestions to improve the service:
Prima di inviare la valutazione, proponici dei suggerimenti per migliorare la documentazione.
Immagini, contenuti, struttura... Spiegaci perché, così possiamo migliorarla insieme!
Le richieste di assistenza non sono gestite con questo form. Se ti serve supporto, utilizza il form "Crea un ticket" .
Grazie per averci inviato il tuo feedback.
Accedi al tuo spazio nella Community Fai domande, cerca informazioni, pubblica contenuti e interagisci con gli altri membri della Community OVHcloud
Discuss with the OVHcloud community