> 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/yolo11.md).

# YOLO11

YOLO11 ऑब्जेक्ट डिटेक्शन के माध्यम से चलता है [Serverless Hosted API](/roboflow/roboflow-hi/deploy/serverless-hosted-api-v2.md), COCO पर 640 इनपुट साइज पर pretrained. Self-hosted deployment के लिए, देखें [Roboflow Inference](https://inference.roboflow.com/).

## कोड नमूना

यह sample Serverless Hosted API के माध्यम से inference चलाता है, response को decode करता है [`supervision`](https://supervision.roboflow.com/), और एक annotated image को disk पर लिखता है।

{% 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 %}

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

ये दो packages model को call करते हैं और इसके परिणामों को draw करते हैं:

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

{% endstep %}

{% step %}

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

चलाएँ `yolov11n-640` एक sample image पर और boxes तथा labels annotate करें:

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

image_url = "https://media.roboflow.com/quickstart/traffic.jpg"
content = requests.get(image_url).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"],
)

results = client.infer(image, model_id="yolov11n-640")
detections = sv.Detections.from_inference(results)

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

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

<figure><img src="/files/3228046efe632ff67751a5c6b8766d236e3be895" 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 %}

## Pretrained models और benchmarks

इनमें से किसी भी alias को बतौर पास करें `model_id`। `inference-sdk` प्रत्येक alias को एक pretrained Roboflow Universe model पर resolve करता है; `yolo11*` prefix variants वही models resolve करते हैं.

<table data-search="false"><thead><tr><th>उपनाम</th><th>इनपुट आकार</th><th>mAP50-95</th><th>ONNX latency (ms)*</th><th>TensorRT FP16 (ms)*</th></tr></thead><tbody><tr><td><code>yolov11n-640</code></td><td>640x640</td><td>39.5</td><td>3.4</td><td>2.2</td></tr><tr><td><code>yolov11s-640</code></td><td>640x640</td><td>47.0</td><td>4.5</td><td>2.5</td></tr><tr><td><code>yolov11m-640</code></td><td>640x640</td><td>51.5</td><td>8.3</td><td>3.5</td></tr><tr><td><code>yolov11l-640</code></td><td>640x640</td><td>53.4</td><td>10.7</td><td>4.3</td></tr><tr><td><code>yolov11x-640</code></td><td>640x640</td><td>54.7</td><td>18.8</td><td>7.1</td></tr></tbody></table>

\# YOLO11 Instance Segmentation

YOLO11 instance segmentation के माध्यम से चलता है [Serverless Hosted API](/roboflow/roboflow-hi/deploy/serverless-hosted-api-v2.md), COCO पर 640 इनपुट साइज पर pretrained. Self-hosted deployment के लिए, देखें [Roboflow Inference](https://inference.roboflow.com/).

## कोड नमूना

अपनी API key सेट करें और ऊपर दिखाए अनुसार dependencies इंस्टॉल करें, फिर चलाएँ `yolov11n-seg-640` और masks तथा labels को annotate करें:

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

image_url = "https://media.roboflow.com/quickstart/traffic.jpg"
content = requests.get(image_url).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"],
)

results = client.infer(image, model_id="yolov11n-seg-640")
detections = sv.Detections.from_inference(results)

annotated = sv.MaskAnnotator().annotate(image.copy(), detections)
annotated = sv.LabelAnnotator(text_position=sv.Position.CENTER_OF_MASS).annotate(annotated, detections)

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

<figure><img src="/files/93bf077f4c880b3ccc43f61ff8860d7c2a335844" alt=""><figcaption></figcaption></figure>

## Pretrained models और benchmarks

इनमें से किसी भी alias को बतौर पास करें `model_id`; `yolo11*` prefix variants वही models resolve करते हैं.

<table data-search="false"><thead><tr><th>उपनाम</th><th>इनपुट आकार</th><th>Box mAP50-95</th><th>Mask mAP50-95</th><th>ONNX latency (ms)*</th><th>TensorRT FP16 (ms)*</th></tr></thead><tbody><tr><td><code>yolov11n-seg-640</code></td><td>640x640</td><td>38.9</td><td>32.0</td><td>7.3</td><td>5.7</td></tr><tr><td><code>yolov11s-seg-640</code></td><td>640x640</td><td>46.6</td><td>37.8</td><td>10.0</td><td>7.5</td></tr><tr><td><code>yolov11m-seg-640</code></td><td>640x640</td><td>51.5</td><td>41.5</td><td>14.5</td><td>9.1</td></tr><tr><td><code>yolov11l-seg-640</code></td><td>640x640</td><td>53.4</td><td>42.9</td><td>16.8</td><td>9.7</td></tr><tr><td><code>yolov11x-seg-640</code></td><td>640x640</td><td>54.7</td><td>43.8</td><td>27.5</td><td>13.1</td></tr></tbody></table>

***

\* Latency मापी जाती है [Roboflow Inference](https://inference.roboflow.com/) 1x NVIDIA L4 पर, batch size 1, 1,000 inferences का औसत (100 warmup)। डिफ़ॉल्ट `inference-gpu` install CUDA execution provider पर ONNX चलाता है; `inference-models[trt10]` extra स्वतः एक prebuilt TensorRT FP16 engine चुनता है। FP16, COCO पर FP32 accuracy से 0.1 mAP के भीतर मेल खाता है `val2017`. Accuracy प्रकाशित COCO `val2017` spec ([स्रोत](https://docs.ultralytics.com/models/yolo11/)).
