> 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/roboflow/roboflow-jp/deploy/supported-models/yolo11.md).

# YOLO11

当社の [Serverless Hosted API](/roboflow/roboflow-jp/deploy/serverless-hosted-api-v2.md). YOLO11 は COCO で事前学習された 2 つのタスクバリアントで利用できます:

* 物体検出（入力サイズ 640 と 1280）
* インスタンスセグメンテーション（入力サイズ 640）

セルフホスト型デプロイについては、 [Roboflow Inference](https://inference.roboflow.com/).

## コードサンプル

依存関係をインストールします:

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

以下の各サンプルは Serverless Hosted API を介して推論を実行し、応答を [`supervision`](https://supervision.roboflow.com/)でデコードし、注釈付き画像をディスクに書き出します。あなたの [Roboflow API Key](https://app.roboflow.com/settings/api) を `API_KEY` 環境変数。

### Object detection

実行 `yolov11n-640` サンプル画像に適用し、バウンディングボックスとラベルを注釈します。

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

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)
```

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

### Instance segmentation

実行 `yolov11n-seg-640` サンプル画像に適用し、マスクとラベルを注釈します。

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

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

mask_annotator = sv.MaskAnnotator()
label_annotator = sv.LabelAnnotator(text_position=sv.Position.CENTER_OF_MASS)

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

cv2.imwrite("bicycle-annotated.png", annotated)
```

<figure><img src="/files/02297aef2de810407c9166a775c3c84a817f1d85" alt=""><figcaption></figcaption></figure>

## デフォルトの COCO エイリアス

次のいずれかのエイリアスを `model_id`として渡すことができます。 `inference-sdk` 各エイリアスを事前学習済みの Roboflow Universe モデルに解決します。

| タスク       | エイリアス              |
| --------- | ------------------ |
| 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`    |
| セグメンテーション | `yolov11n-seg-640` |
| セグメンテーション | `yolov11s-seg-640` |
| セグメンテーション | `yolov11m-seg-640` |
| セグメンテーション | `yolov11l-seg-640` |
| セグメンテーション | `yolov11x-seg-640` |

この `yolo11*` プレフィックスのバリアントは同じモデルに解決されます。

{% hint style="info" %}
設定 `api_url` をデプロイ先に合わせてください:

* `https://serverless.roboflow.com` は Serverless Hosted API 用です。
* `http://localhost:9001` ローカル [Inference](https://inference.roboflow.com/) サーバー用です。
* あなたの [Dedicated Deployment](/roboflow/roboflow-jp/deploy/dedicated-deployments.md) の URL はプライベートエンドポイント用です。
  {% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.roboflow.com/roboflow/roboflow-jp/deploy/supported-models/yolo11.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
