# YOLO26

We support YOLO26 inferencing via our [Serverless Hosted API](/deploy/serverless-hosted-api-v2.md). YOLO26 is available in three task variants pretrained on COCO:

* Object detection
* Instance segmentation
* Keypoint (pose) detection

For self-hosted deployment, see [Roboflow Inference](https://inference.roboflow.com/).

## Code samples

Install the SDK and the [supervision](https://supervision.roboflow.com/) library for annotation:

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

Pass your [Roboflow API Key](https://app.roboflow.com/settings/api) via the `API_KEY` environment variable. Each sample downloads a test image, runs inference through `inference-sdk`, decodes the response with `supervision`, and writes an annotated PNG to disk.

### Object detection

```python
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"),
)
result = client.infer(image_path, model_id="yolo26n-640")
detections = sv.Detections.from_inference(result)

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

<figure><img src="/files/QKdkDGTtoC39Ig3VKH24" alt=""><figcaption></figcaption></figure>

### Instance segmentation

```python
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/bicycle.png"
image_path = "bicycle.png"
urllib.request.urlretrieve(image_url, image_path)

client = InferenceHTTPClient(
    api_url="https://serverless.roboflow.com",
    api_key=os.getenv("API_KEY"),
)
result = client.infer(image_path, model_id="yolo26n-seg-640")
detections = sv.Detections.from_inference(result)

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

<figure><img src="/files/CL1yVLKzoqElWZQSKgjV" alt=""><figcaption></figcaption></figure>

### Keypoint detection

```python
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/person-walking.png"
image_path = "person-walking.png"
urllib.request.urlretrieve(image_url, image_path)

client = InferenceHTTPClient(
    api_url="https://serverless.roboflow.com",
    api_key=os.getenv("API_KEY"),
)
result = client.infer(image_path, model_id="yolo26n-pose-640")
key_points = sv.KeyPoints.from_inference(result)

image = cv2.imread(image_path)
annotated = sv.VertexAnnotator(color=sv.Color.RED, radius=5).annotate(
    scene=image.copy(), key_points=key_points
)
cv2.imwrite("person-walking-annotated.png", annotated)
```

<figure><img src="/files/vJrvqemcqmQKWkttl45J" alt=""><figcaption></figcaption></figure>

## Default COCO aliases

Pass any of the following aliases as `model_id` when calling the SDK. The `inference-sdk` resolves each alias to its pretrained Roboflow Universe model client-side.

| Task         | Alias              |
| ------------ | ------------------ |
| Detection    | `yolo26n-640`      |
| Detection    | `yolo26s-640`      |
| Detection    | `yolo26m-640`      |
| Detection    | `yolo26l-640`      |
| Detection    | `yolo26x-640`      |
| Segmentation | `yolo26n-seg-640`  |
| Segmentation | `yolo26s-seg-640`  |
| Segmentation | `yolo26m-seg-640`  |
| Segmentation | `yolo26l-seg-640`  |
| Segmentation | `yolo26x-seg-640`  |
| Pose         | `yolo26n-pose-640` |
| Pose         | `yolo26s-pose-640` |
| Pose         | `yolo26m-pose-640` |
| Pose         | `yolo26l-pose-640` |
| Pose         | `yolo26x-pose-640` |

The `yolov26*` prefix variants resolve to the same models.

{% hint style="info" %}
Set `api_url` to match your deployment target:

* `https://serverless.roboflow.com` for the Serverless Hosted API.
* `http://localhost:9001` for a local [Inference](https://inference.roboflow.com/) server.
* Your [Dedicated Deployment](/deploy/dedicated-deployments.md) URL for a private endpoint.
  {% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.roboflow.com/deploy/supported-models/yolo26.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
