My customer accountContact commercialWebmailOVHcloud Blog

Welcome to OVHcloud.

Log in to order, manage your products and services, and track your orders

Log in

Object detection - training YOLOv5 on a custom dataset

Example on how to use a YOLOv5 model on AI Training

Last updated 21st of June, 2021.


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.


  • access to the OVHcloud Control Panel
  • an AI Training project created inside a Public Cloud project
  • a user for AI Training
  • your own dataset


Uploading your dataset on Public Cloud Storage

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 "YOLO v5 Pytorch" available for free on Roboflow.

Launching and accessing Jupyter notebook with Pytorch library

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.

Choose the same region as your object container > select the Pytorch docker image > Attach Object Storage containers (the one that contains your dataset)


If you want to launch it with the CLI, choose the volume you want to attach and the number of GPUs (<nb-gpus>) to use on your job and use the following command:

ovhai job run ovhcom/ai-training-pytorch:1.8.1 --volume <container@region/prefix:mount_path:permission:cache> --gpu <nb-gpus>

For this tutorial, we advise you to use at least 2 GPUs.

You can then reach your notebook's URL once the job is Running.

Cloning the GitHub repository

The GitHub repository containing all examples for OVHcloud AI TRAINING is available here.

Inside your notebook, open a new Terminal tab by clicking File > New > Terminal.


Run the following command in the notebook's terminal to clone the repository:

git clone

Once the repository has been cloned, find your notebook by following this path: ai-training-examples > notebooks > pytorch > tuto > notebook_object_detection_yolov5.


Experimenting YOLOv5 notebook

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:

Did you find this guide useful?

Please feel free to give any suggestions in order to improve this documentation.

Whether your feedback is about images, content, or structure, please share it, so that we can improve it together.

Your support requests will not be processed via this form. To do this, please use the "Create a ticket" form.

Thank you. Your feedback has been received.

These guides might also interest you...

OVHcloud Community

Access your community space. Ask questions, search for information, post content, and interact with other OVHcloud Community members.

Discuss with the OVHcloud community