YOLO11

Use the YOLO11 model family through our Serverless Hosted API

We support YOLO11 inferencing via our Serverless Hosted API. YOLO11 is available in two task variants pretrained on COCO:

  • Object detection (640 and 1280 input sizes)

  • Instance segmentation (640 input size)

For self-hosted deployment, see Roboflow Inference.

Code samples

Install the dependencies:

pip install inference-sdk supervision

Each sample below runs inference through the Serverless Hosted API, decodes the response with supervision, and writes an annotated image to disk. Pass your Roboflow API Key via the API_KEY environment variable.

Object detection

Run yolov11n-640 on a sample image and annotate boxes and labels.

import os
import urllib.request

import cv2
import supervision as sv
from inference_sdk import InferenceHTTPClient

image_url = "https://storage.googleapis.com/com-roboflow-marketing/notebooks/examples/cars-highway.png"
image_path = "cars-highway.png"
urllib.request.urlretrieve(image_url, image_path)

client = InferenceHTTPClient(
    api_url="https://serverless.roboflow.com",
    api_key=os.getenv("API_KEY"),
)

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

box_annotator = sv.BoxAnnotator()
label_annotator = sv.LabelAnnotator()

annotated = box_annotator.annotate(scene=image.copy(), detections=detections)
annotated = label_annotator.annotate(scene=annotated, detections=detections)

cv2.imwrite("cars-highway-annotated.png", annotated)

Instance segmentation

Run yolov11n-seg-640 on a sample image and annotate masks and labels.

Default COCO aliases

You can pass any of the following aliases as the model_id. The inference-sdk resolves each alias to a pretrained Roboflow Universe model.

Task
Alias

Detection

yolov11n-640

Detection

yolov11s-640

Detection

yolov11m-640

Detection

yolov11l-640

Detection

yolov11x-640

Detection

yolov11n-1280

Detection

yolov11s-1280

Detection

yolov11m-1280

Detection

yolov11l-1280

Detection

yolov11x-1280

Segmentation

yolov11n-seg-640

Segmentation

yolov11s-seg-640

Segmentation

yolov11m-seg-640

Segmentation

yolov11l-seg-640

Segmentation

yolov11x-seg-640

The yolo11* prefix variants resolve to the same models.

Set api_url to match your deployment target:

  • https://serverless.roboflow.com for the Serverless Hosted API.

  • http://localhost:9001 for a local Inference server.

  • Your Dedicated Deployment URL for a private endpoint.

Last updated

Was this helpful?