> 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/models/ko/supported-models/yolov9.md).

# YOLOv9

저희를 통해 YOLOv9 객체 탐지 추론을 지원합니다 [서버리스 클라우드 API](https://docs.roboflow.com/deployment/roboflow-cloud/serverless-api). YOLOv9 훈련은 Roboflow에서 지원되지 않지만, [사전 학습된 가중치 업로드](/models/ko/model-weights/upload-custom-weights.md) 기존 프로젝트에 대해 이를 제공하고 Serverless Cloud API를 통해 서빙할 수 있습니다.

자체 호스팅 배포는 다음을 참조하세요 [Roboflow Inference](https://docs.roboflow.com/deployment/self-hosted/self-hosted).

YOLOv9 입력 크기는 Roboflow 외부에서 모델을 훈련할 때 설정됩니다(일반적인 값: 640x640 또는 1280x1280).

## YOLOv9 API

{% stepper %}
{% step %}

### API 키 받기

Roboflow 계정을 만들고, [Roboflow API 설정 페이지](https://app.roboflow.com/settings/api) 에서 키를 찾아 셸에서 사용할 수 있게 하세요:

```bash
export ROBOFLOW_API_KEY="your-key-here"
```

{% endstep %}

{% step %}

### 의존성을 설치하세요

SDK와 [supervision](https://supervision.roboflow.com/) 디코딩 및 주석 처리를 위해:

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

{% endstep %}

{% step %}

### 모델 실행

이 예시는 [COCO](https://universe.roboflow.com/microsoft/coco) (`coco/18`를 사용하여 Roboflow의 공개 YOLOv9 모델을 실행하므로, 그대로 작동합니다. 자체 가중치를 제공하려면, `{workspace}/{model-slug}` ID(참조 [버전, 학습, 모델](/models/ko/versions-trainings-and-models.md)).

```python
import os
import cv2
import supervision as sv
from inference_sdk import InferenceHTTPClient, InferenceConfiguration

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"],
).configure(InferenceConfiguration(api_key_transport="header"))
result = client.infer(image, model_id="coco/18")

detections = sv.Detections.from_inference(result)

annotated = sv.BoxAnnotator().annotate(image.copy(), detections)
annotated = sv.LabelAnnotator().annotate(annotated, detections)

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

<figure><img src="/files/faa0861c1ddd23e3df2dea37102fe5abc3133271" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

{% hint style="info" %}
설정하세요 `api_url` 를 배포 대상에 맞게:

* `https://serverless.roboflow.com` 는 서버리스 클라우드 API용입니다.
* `http://localhost:9001` 로컬 [Inference](https://docs.roboflow.com/deployment/self-hosted/self-hosted) 서버용입니다.
* 귀하의 [전용 배포](https://docs.roboflow.com/deployment/roboflow-cloud/dedicated-deployments) 는 비공개 엔드포인트의 URL입니다.
  {% endhint %}
