---
title: "AI Notebooks - Tutoriel - Entraîner YOLOv5 sur votre jeu de données (EN)"
description: "Comment entraîner le modèle YOLOv5 sur un jeu de données personnalisé avec AI Notebooks"
url: https://docs.ovhcloud.com/fr/guides/public-cloud/ai-machine-learning/ai-notebooks-yolov5-example
lang: fr
lastUpdated: 2023-05-11
---
# AI Notebooks - Tutoriel - Entraîner YOLOv5 sur votre jeu de données (EN)

## Objective

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.

![image](/images/public-cloud/ai-machine-learning/notebook-tuto-04-yolov5/image-yolov5.png)
It is based on the YOLOv5 open source repository by [Ultralytics](https://github.com/ultralytics/yolov5).

## Requirements

- An AI Notebooks project created inside a [Public Cloud project](https://www.ovhcloud.com/fr/public-cloud/) in your OVHcloud account;
- A user for AI Notebooks;
- Your own dataset.


***

### OVHcloud Control Panel Access

- **Direct link:** <ManagerLink to="/#/pci/projects">Public Cloud Projects</ManagerLink>
- **Navigation path:** <code className="action">Public Cloud</code> > Select your project

***


## Instructions

### 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
`.
![image](/images/public-cloud/ai-machine-learning/notebook-tuto-04-yolov5/new-object-container.png)
If you want to run it with the CLI, just follow this [guide](/fr/guides/public-cloud/ai-machine-learning/ai-cli-access-data.md). You have to choose the region, the name of your container and the path where your data is located and use the following command:

```bash
ovhai bucket object upload <container>@<region> <paths>
```

:::info
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](https://public.roboflow.com/object-detection/microsoft-coco-subset/).

:::

### Launching and accessing Jupyter notebook with PyTorch framework

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](/fr/guides/public-cloud/ai-machine-learning/ai-cli-access-data.md).

If you want to launch it from the OVHcloud Control Panel
, just follow this [guide](/fr/guides/public-cloud/ai-machine-learning/ai-notebooks-definition.md)
.
1. `Name your notebook`
2. `Choose Jupyterlab editor`
3. `Select the PyTorch framework`
4. `Choose the access type`
5. `Select the datacenter location (same region as your object container)`
6. `Choose the number of GPUs or CPUs you need`

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

:::


1. `Attach Object Storage containers
`


:::warning
In this tutorial, you need 2 object containers.

:::

- the **first object container** contains your dataset (labelled and separated) and your `data.yaml` file.
- the **second object container** is empty. It is intended to save your model weights (for a future inference for example).

![image](/images/public-cloud/ai-machine-learning/notebook-tuto-04-yolov5/notebook-attach-data.png)
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`.


1. `Attach public ssh keys only if you want to
`
1. `Check that everything is ok and launch your notebook
`


If you want to launch it with the CLI, choose the [volumes](/fr/guides/public-cloud/ai-machine-learning/ai-cli-access-data.md) you want to attach and the number of GPUs (`<nb-gpus>`) to use on your notebook and use the following command:

```bash
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:

![image](/images/public-cloud/ai-machine-learning/notebook-tuto-04-yolov5/overview-notebook.png)
### 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](https://github.com/ovh/ai-training-examples/blob/main/notebooks/computer-vision/object-detection/miniconda/yolov5/notebook_object_detection_yolov5_coco.ipynb).

### Go further

- Do you want to observe the evolution of your metrics during the training of your model? Click [here](/fr/guides/public-cloud/ai-machine-learning/ai-notebooks-weights-biases.md)!
- Do you want to use your YOLOv5 model in an app? [Here it is](/fr/guides/public-cloud/ai-machine-learning/ai-deploy-web-service-yolov5.md).

If you need training or technical assistance to implement our solutions, contact your sales representative or click on [this link](https://www.ovhcloud.com/fr/professional-services/) to get a quote and ask our Professional Services experts for a custom analysis of your project.

## Feedback

Please send us your questions, feedback and suggestions to improve the service:

- On the OVHcloud [Discord server](https://discord.gg/ovhcloud)
