YOLO-World is an open-vocabulary object detection model that detects objects from arbitrary text class names without training. We support YOLO-World inferencing via our Serverless Cloud API.
For more details on running YOLO-World, see the Inference docs.
YOLO-World API
Run YOLO-World through the HTTP endpoint directly with curl, or with the inference-sdk wrapper.
Get your API Key
Create a Roboflow account, find your key on the Roboflow API settings page and make it available to your shell:
export ROBOFLOW_API_KEY="your-key-here"Run the model
Call the /yolo_world/infer endpoint with curl:
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
}'Get your API Key
Create a Roboflow account, find your key on the Roboflow API settings page and make it available to your shell:
export ROBOFLOW_API_KEY="your-key-here"Install the dependencies
Install the SDK and supervision:
pip install -U inference-sdk supervisionRun the model
Run YOLO-World with custom class names, then decode and visualize the predictions with supervision.
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)
The class_names argument accepts any list of class names. Available model_version values: v2-s, v2-m, v2-l, v2-x, s, m, l, x.
YOLO-World inference speed
Latency measured with Roboflow Inference on 1x NVIDIA L4, batch size 1, mean after warmup.
| Model | Latency (ms) |
|---|---|
yolo-world | 12.4 |
Measured on the v2-s variant with two classes. Setting the class list runs a text encoder once, and is excluded from this figure since it is not repeated per frame.
Set api_url to match your deployment target:
https://serverless.roboflow.comfor the Serverless Cloud API.http://localhost:9001for a local Inference server.- Your Dedicated Deployment URL for a private endpoint.
Run YOLO-World with self-hosted Inference
YOLO-World also runs on your own hardware, either loaded in-process with the inference package or served by a local Inference server. On capable hardware (for example a V100 GPU) it runs in real time, which makes it a practical choice for video.
pip install "inference[yolo-world]" supervisionimport 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)pip install inference inference-sdk
inference server start # serves http://localhost:9001import 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]Add the YOLO-World block to a Workflow and set the classes you want to detect. Then stream a webcam, camera feed, or video file through that Workflow with the Inference SDK WebRTC client.
In the native package, YOLO-World checkpoints are identified as yolo_world/<version>, where <version> is one of s, m, l, x, v2-s, v2-m, v2-l, v2-x. The v2- checkpoints are newer and score better on evaluation metrics.
Like most zero-shot detectors, YOLO-World is strongest on common objects (cars, people, dogs) and weaker on narrow, fine-grained categories. Experiment with prompt wording to find what works for your scene.