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

एक Model Local रूप से चलाएँ

Docker inference server के साथ, पाँच मिनट में अपने hardware पर Roboflow models चलाएँ।

Roboflow Inference Roboflow के hosted models के पीछे का free, open-source engine है। आप वही models अपने कंप्यूटर पर चला सकते हैं: Docker container में Inference Server शुरू करें, फिर HTTP या Python के साथ उसे images भेजें Inference SDK. इसे खुद चलाने से आपकी images आपकी अपनी machine पर रहती हैं और आपको अपने setup पर पूरा नियंत्रण मिलता है।

अपनी machine पर एक model चलाएँ

1

Inference Server शुरू करें

inference server start शुरू करता है Inference Server एक Docker container में और आपके hardware के लिए सही version चुनता है: CPU, NVIDIA GPU, या Jetson। Docker इंस्टॉल और चल रहा होना चाहिए।

pip install inference-cli && inference server start

Server इस पर listen करता है http://localhost:9001. Device-specific setup और troubleshooting के लिए, देखें Inference install guide.

2

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

supervision results को draw करता है और जोड़ता है cv2 और numpy:

pip install supervision
3

मॉडल चलाएँ

image को अपने local server पर भेजें और एक ready-made RF-DETR model चलाएँ। इस तरह के ready-made models को API key की जरूरत नहीं होती:

import base64
import cv2
import numpy as np
import requests
import supervision as sv

content = requests.get("https://media.roboflow.com/quickstart/cars.jpg").content
image = cv2.imdecode(np.frombuffer(content, np.uint8), cv2.IMREAD_COLOR)
image_b64 = base64.b64encode(content).decode("utf-8")

result = requests.post(
    "http://localhost:9001/coco/38",  # coco/38 == rfdetr-nano
    data=image_b64,  # raw base64 in the body
    headers={"Content-Type": "application/x-www-form-urlencoded"},
).json()
detections = sv.Detections.from_inference(result)
print(f"Found {len(detections)} objects")

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

पहला request model डाउनलोड करता है, इसलिए इसमें कुछ सेकंड लग सकते हैं। बाद के requests तेज़ होते हैं।

RF-DETR car and truck bounding boxes on a road scene
local inference server से RF-DETR detections

एक video प्रोसेस करें

Video पर model चलाने के लिए, आप उसे server पर भेजते हैं और हर frame वापस मिलता है, boxes पहले से drawn हुए, जैसे यह चलता है। अगर आपका computer साथ नहीं दे पाता, तो server real time में रहने के लिए frames छोड़ देता है। यह Python SDK और एक Workflow: एक saved setup जो model चलाता है और आपके लिए results draw करता है।

आप HTTP के माध्यम से भी video पर model चला सकते हैं, ऊपर image example की तरह एक-एक frame भेजकर (कोई streaming add-on नहीं चाहिए)। यह धीमा है: अगला frame शुरू होने से पहले हर frame भेजा, process किया, और drawn किया जाना होता है, इसलिए बीच में काफी इंतज़ार होता है। SDK पूरे video को stream करता है और एक साथ कई frames पर काम करता है, इसलिए यह बहुत बेहतर तरीके से साथ देता है।

1

SDK इंस्टॉल करें

Streaming video को webrtc add-on चाहिए:

2

Video पर model चलाएँ

Workflows editor में दृश्य रूप से और समृद्ध pipelines (tracking, filtering, zones, notifications) बनाएं, फिर उन्हें उसी तरह चलाएँ। edge और video-stream deployment के लिए देखें Workflows editor, फिर उन्हें उसी तरह चलाएँ। edge और video-stream deployment के लिए देखें Deploy a Workflow.

अन्य विकल्प

अंतिम अपडेट

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