YOLO11 Object Detection

Use the YOLO11 model family through our Serverless Cloud API

YOLO11 object detection runs through the Serverless Cloud API, pretrained on COCO at 640 input size. For self-hosted deployment, see Roboflow Inference.

YOLO11 Object Detection API

This sample runs inference through the Serverless Cloud API, decodes the response with supervision, and writes an annotated image to disk.

1

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"
2

Install the dependencies

These two packages call the model and draw its results:

pip install -U inference-sdk supervision
3

Run the model

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

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

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

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)

Set api_url to match your deployment target:

  • https://serverless.roboflow.com for the Serverless Cloud API.
  • http://localhost:9001 for a local Inference server.
  • Your Dedicated Deployment URL for a private endpoint.

YOLO11 Object Detection models and benchmarks

Pass any of these aliases as the model_id. The inference-sdk resolves each alias to a pretrained Roboflow Universe model; the yolo11* prefix variants resolve to the same models.

AliasInput SizemAP50-95ONNX 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 runs through the Serverless Cloud API, pretrained on COCO at 640 input size. For self-hosted deployment, see Roboflow Inference.

YOLO11 Instance Segmentation API

Set your API key and install the dependencies as shown above, then run yolov11n-seg-640 and annotate masks and labels:

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

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

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)

YOLO11 Instance Segmentation models and benchmarks

Pass any of these aliases as the model_id; the yolo11* prefix variants resolve to the same models.

AliasInput SizeBox mAP50-95Mask mAP50-95ONNX 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 is measured with Roboflow Inference on 1x NVIDIA L4, batch size 1, mean of 1,000 inferences (100 warmup). The default inference-gpu install runs ONNX on the CUDA execution provider; adding the inference-models[trt10] extra selects a prebuilt TensorRT FP16 engine automatically. FP16 matches FP32 accuracy within 0.1 mAP on COCO val2017. Accuracy is the published COCO val2017 spec (source).