[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add from_azure_analyze_image data loader #571

Merged
merged 9 commits into from
Dec 5, 2023
Merged

Conversation

capjamesg
Copy link
Collaborator
@capjamesg capjamesg commented Nov 3, 2023

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 marked this pull request as ready for review November 27, 2023 10:51
@SkalskiP SkalskiP merged commit 07fc560 into develop Dec 5, 2023
7 checks passed
@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.

None yet

2 participants