Skip to content

Add from_azure_analyze_image data loader - #571

Merged
SkalskiP merged 9 commits into
developfrom
add-azure-analyze-image
Dec 5, 2023
Merged

Add from_azure_analyze_image data loader#571
SkalskiP merged 9 commits into
developfrom
add-azure-analyze-image

Conversation

@capjamesg

@capjamesg capjamesg commented Nov 3, 2023

Copy link
Copy Markdown
Contributor

Description

This PR adds a sv.Detections.from_azure_analyze_image() data loader. This allows someone to load detections from the Azure Image Analysis 4.0 API.

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

How has this change been tested, please provide a testcase or example of how you tested the change?

You will need to create an Azure account. Once you have an Azure account, create a "Computer vision" deployment in the "Azure AI services" dashboard in Azure.

This deployment will give you two API keys and an endpoint URL.

Set your API key and endpoint URL in your environment:

export AZURE_VISION_SUBSCRIPTION_KEY=<your api key>
export AZURE_VISION_ENDPOINT=<your endpoint>

Use the following example to run inference:

import supervision as sv
import requests
image = open(input, "rb").read()

endpoint = "https://.cognitiveservices.azure.com/"

headers = {
   "Content-Type": "application/octet-stream",
   "Ocp-Apim-Subscription-Key": "key"
}

response = requests.post(endpoint, headers=headers, data=image).json()

detections = sv.Detections.from_azure_analyze_image(response)

Any specific deployment considerations

N/A

Docs

I will add documentation to this PR.

@capjamesg capjamesg self-assigned this Nov 3, 2023
@capjamesg
capjamesg requested a review from SkalskiP November 27, 2023 10:51
@capjamesg
capjamesg marked this pull request as ready for review November 27, 2023 10:51
@SkalskiP
SkalskiP merged commit 07fc560 into develop Dec 5, 2023
@SkalskiP
SkalskiP deleted the add-azure-analyze-image branch January 2, 2024 18:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants