Test_model1 / docs /en /yolov5 /environments /azureml_quickstart_tutorial.md
akswelh's picture
Upload 663 files
f6228f9 verified
metadata
comments: true
description: >-
  Learn how to set up and run YOLOv5 on AzureML. Follow this quickstart guide
  for easy configuration and model training on an AzureML compute instance.
keywords: >-
  YOLOv5, AzureML, machine learning, compute instance, quickstart, model
  training, virtual environment, Python, AI, deep learning

YOLOv5 πŸš€ on AzureML

This guide provides a quickstart to use YOLOv5 from an AzureML compute instance.

Note that this guide is a quickstart for quick trials. If you want to unlock the full power AzureML, you can find the documentation to:

Prerequisites

You need an AzureML workspace.

Create a compute instance

From your AzureML workspace, select Compute > Compute instances > New, select the instance with the resources you need.

create-compute-arrow

Open a Terminal

Now from the Notebooks view, open a Terminal and select your compute.

open-terminal-arrow

Setup and run YOLOv5

Now you can, create a virtual environment:

conda create --name yolov5env -y
conda activate yolov5env
conda install pip -y

Clone YOLOv5 repository with its submodules:

git clone https://github.com/ultralytics/yolov5
cd yolov5
git submodule update --init --recursive # Note that you might have a message asking you to add your folder as a safe.directory just copy the recommended command

Install the required dependencies:

pip install -r yolov5/requirements.txt
pip install onnx>=1.10.0

Train the YOLOv5 model:

python train.py

Validate the model for Precision, Recall, and mAP

python val.py --weights yolov5s.pt

Run inference on images and videos:

python detect.py --weights yolov5s.pt --source path/to/images

Export models to other formats:

python detect.py --weights yolov5s.pt --source path/to/images

Notes on using a notebook

Note that if you want to run these commands from a Notebook, you need to create a new Kernel and select your new Kernel on the top of your Notebook.

If you create Python cells it will automatically use your custom environment, but if you add bash cells, you will need to run source activate <your-env> on each of these cells to make sure it uses your custom environment.

For example:

%%bash
source activate newenv
python val.py --weights yolov5s.pt