For the complete documentation index, see llms.txt. This page is also available as Markdown.

Roboflow 3.0

हमारे Serverless Hosted API के माध्यम से Roboflow 3.0 model family का उपयोग करें

Roboflow 3.0 Object Detection

Roboflow 3.0, Roboflow की इन-हाउस model architecture है। आप Roboflow platform पर Roboflow 3.0 models train करते हैं और उन्हें के माध्यम से deploy करते हैं Serverless Hosted API। नीचे दिया गया sample Roboflow का सार्वजनिक COCO model (coco/3) ताकि आप इसे तुरंत आज़मा सकें। self-hosted deployment के लिए, देखें Roboflow Inference.

कोड नमूना

1

अपनी API Key प्राप्त करें

एक Roboflow खाता बनाएं, अपनी key यहाँ पर ढूँढें Roboflow API settings page और इसे अपने shell में उपलब्ध कराएँ:

export ROBOFLOW_API_KEY="your-key-here"
2

निर्भरताएँ इंस्टॉल करें

इंस्टॉल करें Inference SDK और supervision:

pip install inference-sdk supervision
3

मॉडल चलाएँ

एक sample image पर detection चलाएँ और boxes तथा labels annotate करें:

import os
import cv2
import numpy as np
import requests
import supervision as sv
from inference_sdk import InferenceHTTPClient

content = requests.get("https://media.roboflow.com/quickstart/traffic.jpg").content
image = cv2.imdecode(np.frombuffer(content, np.uint8), cv2.IMREAD_COLOR)

client = InferenceHTTPClient(
    api_url="https://serverless.roboflow.com",
    api_key=os.environ["ROBOFLOW_API_KEY"],
)
result = client.infer(image, model_id="coco/3")

detections = sv.Detections.from_inference(result)

annotated = sv.BoxAnnotator().annotate(image.copy(), detections)
annotated = sv.LabelAnnotator().annotate(annotated, detections)
cv2.imwrite("output.png", annotated)

सेट करें api_url को अपने deployment target से मिलाएँ:

  • https://serverless.roboflow.com Serverless Hosted API के लिए।

  • http://localhost:9001 एक local Inference server.

  • आपका Dedicated Deployment एक private endpoint के लिए URL.

Roboflow 3.0 Instance Segmentation

एक Roboflow 3.0 instance segmentation model train करें, फिर बदलें your-project/1 अपने {workspace}/{model-slug} ID (देखें Versions, Trainings, and Models)। अपना API key सेट करें और ऊपर दिखाए अनुसार dependencies install करें।

कोड नमूना

import os
import cv2
import numpy as np
import requests
import supervision as sv
from inference_sdk import InferenceHTTPClient

content = requests.get("https://media.roboflow.com/quickstart/traffic.jpg").content
image = cv2.imdecode(np.frombuffer(content, np.uint8), cv2.IMREAD_COLOR)

client = InferenceHTTPClient(
    api_url="https://serverless.roboflow.com",
    api_key=os.environ["ROBOFLOW_API_KEY"],
)
# No pretrained aliases: अपना model train करें और "your-project/1" को अपने model ID से बदलें।
result = client.infer(image, model_id="your-project/1")

detections = sv.Detections.from_inference(result)

annotated = sv.MaskAnnotator().annotate(image.copy(), detections)
annotated = sv.LabelAnnotator().annotate(annotated, detections)
cv2.imwrite("output.png", annotated)

Roboflow 3.0 Keypoint Detection

यह उदाहरण सार्वजनिक rf-handpose hand keypoint model चलाता है, फिर 21-बिंदु hand skeleton बनाता है। अपना {workspace}/{model-slug}. अपना API key सेट करें और ऊपर दिखाए अनुसार dependencies install करें।

कोड नमूना

Roboflow 3.0 Classification

Classification responses में confidence के साथ class predictions की एक सूची होती है, इसलिए visualization लागू नहीं होती। top class को सीधे response से पढ़ें। बदलें your-project/1 इसे अपने trained model ID से बदलें, और अपना API key सेट करें तथा ऊपर दिखाए अनुसार dependencies install करें।

कोड नमूना

अंतिम अपडेट

क्या यह उपयोगी था?