Search code examples
azuredeploymentazure-functionsobject-detectionyolov5

Deploying Yolov5 to azure


How to deploy Custom trained YOLOV5 model to azure using azure functions? I couldn’t find any online resources

Complete Scenario:

There is a sharepoint app where user will upload the videos, once the new video is uploaded, it should trigger the flow to azure function, this azure function should be able to predict the objects in the frame with the custom trained yolov5 model


Solution

  • We are not sure about the Deployment of YOLO5 in Azure Function.

    Follow the below steps, it will work for any ML model using Azure Function

    Prerequisites:

    1. Install Azure CLI
    2. Install Azure Function Core Tools

    1. Create and test Azure function locally

    Using CLI create a python function

    _# Create and activate an environment_  
    python3 -m venv .venv  
    source .venv/bin/activate_
    # Create a FunctionApp Project Locally_  
    func init --worker-runtime python_
    # Create a Function_  
    func new --name <FunctionName> --template "HTTP trigger" --authlevel anonymous
    

    Edit the__init__.py file for your business logic to modify your model.

    Add the required packages in requirement.txt. After that install the packages using

    pip install -r requirements.txt
    

    Test your function locally. using func start

    2. Create the Required Resources for your Project on Azure

    3. Deploy the function to Azure

    Deploy local project code to the Function App created on Azure, using

    func azure functionapp publish **<FuncitonAPP Name>**
    

    Refer Build and Deploy your NLP model as a Microservice on Azure