> For the complete documentation index, see [llms.txt](https://docs.roboflow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.roboflow.com/roboflow/roboflow-hi/deploy/supported-models/yolov9.md).

# YOLOv9

हम अपने प्लेटफ़ॉर्म के माध्यम से YOLOv9 ऑब्जेक्ट डिटेक्शन inferencing का समर्थन करते हैं [Serverless Hosted API](/roboflow/roboflow-hi/deploy/serverless-hosted-api-v2.md). YOLOv9 को train करना Roboflow पर समर्थित नहीं है, लेकिन आप कर सकते हैं [pretrained weights अपलोड करें](/roboflow/roboflow-hi/deploy/upload-custom-weights.md) किसी मौजूदा Project के लिए और उन्हें Serverless Hosted API के माध्यम से serve करें।

self-hosted deployment के लिए, देखें [Roboflow Inference](https://inference.roboflow.com/).

YOLOv9 input size तब सेट किया जाता है जब आप अपना model Roboflow के बाहर train करते हैं (सामान्य मान: 640x640 या 1280x1280)।

## कोड नमूना

{% stepper %}
{% step %}

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

एक Roboflow खाता बनाएं, अपनी key यहाँ पर ढूँढें [Roboflow API settings page](https://app.roboflow.com/settings/api) और इसे अपने shell में उपलब्ध कराएँ:

```bash
export ROBOFLOW_API_KEY="your-key-here"
```

{% endstep %}

{% step %}

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

SDK इंस्टॉल करें और [supervision](https://supervision.roboflow.com/) decoding और annotation के लिए:

```bash
pip install inference-sdk supervision
```

{% endstep %}

{% step %}

### मॉडल चलाएँ

यह उदाहरण Roboflow के public YOLOv9 model को चलाता है, जिसे train किया गया है [COCO](https://universe.roboflow.com/microsoft/coco) (`coco/18`), इसलिए यह as-is काम करता है। अपनी खुद की weights serve करने के लिए, अपने `{workspace}/{model-slug}` ID (देखें [Versions, Trainings, and Models](/roboflow/roboflow-hi/train/versions-trainings-and-models.md)).

```python
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/18")

detections = sv.Detections.from_inference(result)

annotated = sv.BoxAnnotator().annotate(image.copy(), detections)
annotated = sv.LabelAnnotator().annotate(annotated, detections)

cv2.imwrite("annotated.png", annotated)
```

<figure><img src="/files/1fbc576b036df9f4eafdf87d8f1aaba88a862e55" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

{% hint style="info" %}
सेट करें `api_url` को अपने deployment target से मिलाएँ:

* `https://serverless.roboflow.com` Serverless Hosted API के लिए।
* `http://localhost:9001` एक local [Inference](https://inference.roboflow.com/) server.
* आपका [Dedicated Deployment](/roboflow/roboflow-hi/deploy/dedicated-deployments.md) एक private endpoint के लिए URL.
  {% endhint %}
