> 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/models/hi/supported-models/yolov9.md).

# YOLOv9

हम अपने माध्यम से YOLOv9 ऑब्जेक्ट डिटेक्शन इनफरेंसिंग का समर्थन करते हैं [सर्वरलेस होस्टेड API](https://docs.roboflow.com/deployment/roboflow-cloud/serverless-api). Roboflow पर YOLOv9 को प्रशिक्षित करना समर्थित नहीं है, लेकिन आप [पूर्व-प्रशिक्षित वज़न अपलोड करें](/models/hi/model-weights/upload-custom-weights.md) किसी मौजूदा प्रोजेक्ट के लिए और उन्हें Serverless Hosted API के माध्यम से सर्व करें।

स्व-होस्टेड डिप्लॉयमेंट के लिए, देखें [Roboflow Inference](https://docs.roboflow.com/deployment/self-hosted/self-hosted).

YOLOv9 इनपुट आकार तब सेट किया जाता है जब आप अपना मॉडल Roboflow के बाहर प्रशिक्षित करते हैं (सामान्य मान: 640x640 या 1280x1280)।

## कोड नमूना

{% stepper %}
{% step %}

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

एक Roboflow खाता बनाएँ, अपनी कुंजी यहाँ खोजें [Roboflow API सेटिंग्स पेज](https://app.roboflow.com/settings/api) और इसे अपने shell के लिए उपलब्ध कराएँ:

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

{% endstep %}

{% step %}

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

SDK और [supervision](https://supervision.roboflow.com/) डिकोडिंग और एनोटेशन के लिए:

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

{% endstep %}

{% step %}

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

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

```python
import os
import cv2
import supervision as sv
from inference_sdk import InferenceHTTPClient

image = sv.load_image_from_url("https://media.roboflow.com/quickstart/traffic.jpg")

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/711163661454bbecc9d30b266c1289e4b903ceec" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

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

* `https://serverless.roboflow.com` सर्वरलेस होस्टेड API के लिए।
* `http://localhost:9001` एक स्थानीय [Inference](https://docs.roboflow.com/deployment/self-hosted/self-hosted) server के लिए।
* आपका [समर्पित परिनियोजन](https://docs.roboflow.com/deployment/roboflow-cloud/dedicated-deployments) एक निजी endpoint के लिए URL।
  {% endhint %}
