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

# YOLO-World

YOLO-World एक ओपन-वोकैबुलरी ऑब्जेक्ट डिटेक्शन मॉडल है जो बिना प्रशिक्षण के मनमाने टेक्स्ट क्लास नामों से ऑब्जेक्ट्स का पता लगाता है। हम अपने माध्यम से YOLO-World इन्फ़रेंसिंग का समर्थन करते हैं [सर्वरलेस होस्टेड API](https://docs.roboflow.com/deployment/roboflow-cloud/serverless-api).

YOLO-World चलाने के बारे में अधिक विवरण के लिए, देखें [इन्फ़रेंस दस्तावेज़](https://docs.roboflow.com/deployment/self-hosted/self-hosted).

## कोड नमूना

YOLO-World को सीधे HTTP endpoint के माध्यम से चलाएँ, साथ `curl`, या साथ में [`inference-sdk`](https://docs.roboflow.com/reference/inference/inference-sdk) रैपर।

{% tabs %}
{% tab title="HTTP (curl)" icon="webhook" %}
{% stepper %}
{% step %}

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

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

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

{% endstep %}

{% step %}

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

कॉल करें `/yolo_world/infer` endpoint के साथ `curl`:

```bash
curl --location 'https://serverless.roboflow.com/yolo_world/infer' \\
  --header 'Content-Type: application/json' \\
  --data '{
    "api_key": "'"$ROBOFLOW_API_KEY"'",
    "image": {"type": "url", "value": "https://media.roboflow.com/quickstart/traffic.jpg"},
    "text": ["car", "truck"],
    "yolo_world_version_id": "v2-s",
    "confidence": 0.05
  }'
```

{% endstep %}
{% endstepper %}
{% endtab %}

{% tab title="SDK (Python)" icon="python" %}
{% 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 %}

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

कस्टम क्लास नामों के साथ YOLO-World चलाएँ, फिर supervision के साथ predictions को decode और visualize करें।

```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"],
)

results = client.infer_from_yolo_world(
    inference_input=image,
    class_names=["car", "truck"],
    model_version="v2-s",
    confidence=0.05,
)

detections = sv.Detections.from_inference(results[0])

labels = [
    f"{name} {conf:.2f}"
    for name, conf in zip(detections.data["class_name"], detections.confidence)
]
annotated = sv.BoxAnnotator().annotate(image.copy(), detections)
annotated = sv.LabelAnnotator().annotate(annotated, detections, labels=labels)
cv2.imwrite("annotated.png", annotated)
```

<figure><img src="/files/23d601ebe5012451093e50ec8bea9c85bfff171d" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}
{% endtab %}
{% endtabs %}

यह `class_names` argument किसी भी class names की सूची को स्वीकार करता है। उपलब्ध `model_version` मान: `v2-s`, `v2-m`, `v2-l`, `v2-x`, `s`, `m`, `l`, `x`.

## इन्फ़रेंस गति

Latency मापी गई [Roboflow Inference](https://docs.roboflow.com/deployment/self-hosted/self-hosted) पर 1x NVIDIA L4, batch size 1, warmup के बाद औसत।

<table data-search="false"><thead><tr><th>मॉडल</th><th>Latency (ms)</th></tr></thead><tbody><tr><td><code>yolo-world</code></td><td>12.4</td></tr></tbody></table>

पर मापा गया `v2-s` दो classes वाले variant पर। class list सेट करने से text encoder एक बार चलता है, और इसे इस figure से बाहर रखा गया है क्योंकि यह प्रति frame दोहराया नहीं जाता।

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

## Inference (self-hosted) के साथ उपयोग करें

YOLO-World आपके अपने hardware पर भी चलता है, या तो [`inference`](https://docs.roboflow.com/deployment/self-hosted/self-hosted) package के साथ in-process लोड करके या स्थानीय Inference server द्वारा सर्व किया जाता है। सक्षम hardware (उदाहरण के लिए V100 GPU) पर यह real time में चलता है, जो इसे वीडियो के लिए एक व्यावहारिक विकल्प बनाता है।

{% tabs %}
{% tab title="Inference (native)" icon="server" %}

```bash
pip install "inference[yolo-world]" supervision
```

```python
import cv2
import supervision as sv

from inference.models.yolo_world.yolo_world import YOLOWorld

image = cv2.imread("image.jpeg")

model = YOLOWorld(model_id="yolo_world/l")
classes = ["person", "backpack", "dog"]
results = model.infer("image.jpeg", text=classes, confidence=0.03)[0]

detections = sv.Detections.from_inference(results)
labels = [classes[class_id] for class_id in detections.class_id]

annotated = sv.BoxAnnotator().annotate(scene=image, detections=detections)
annotated = sv.LabelAnnotator().annotate(
    scene=annotated, detections=detections, labels=labels
)
sv.plot_image(annotated)
```

{% endtab %}

{% tab title="स्थानीय Inference server" icon="docker" %}

```bash
pip install inference inference-sdk
inference server start  # http://localhost:9001 पर सेवा देता है
```

```python
import os
from inference_sdk import InferenceHTTPClient

client = InferenceHTTPClient(
    api_url="http://127.0.0.1:9001",
    api_key=os.environ["ROBOFLOW_API_KEY"],
)

results = client.infer_from_yolo_world(
    inference_input=["https://media.roboflow.com/dog.jpeg"],
    class_names=["person", "backpack", "dog"],
    model_version="l",
    confidence=0.1,
)[0]
```

{% endtab %}

{% tab title="वीडियो" icon="video" %}
YOLO-World ब्लॉक को Workflow में जोड़ें और उन classes को सेट करें जिन्हें आप detect करना चाहते हैं। फिर उस Workflow के माध्यम से webcam, camera feed, या video file को [Inference SDK WebRTC client](https://docs.roboflow.com/workflows/deploy/video-processing).
{% endtab %}
{% endtabs %}

native package में, YOLO-World checkpoints इस रूप में पहचाने जाते हैं `yolo_world/<version>`, जहाँ `<version>` इनमें से एक है `s`, `m`, `l`, `x`, `v2-s`, `v2-m`, `v2-l`, `v2-x`। The `v2-` checkpoints नए हैं और मूल्यांकन मेट्रिक्स पर बेहतर स्कोर करते हैं।

{% hint style="info" %}
अधिकांश zero-shot detectors की तरह, YOLO-World सामान्य वस्तुओं (cars, people, dogs) पर सबसे मजबूत है और संकीर्ण, सूक्ष्म श्रेणियों पर कमजोर है। अपने दृश्य के लिए क्या काम करता है, यह जानने के लिए prompt wording के साथ प्रयोग करें.
{% endhint %}
