> 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/yolov12.md).

# YOLOv12

저희의 YOLOv12 객체 탐지 추론을 [서버리스 호스팅 API](https://docs.roboflow.com/deployment/roboflow-cloud/serverless-api). YOLOv12는 다섯 가지 크기(`n`, `s`, `m`, `l`, `x`) 객체 탐지 작업용으로 지원됩니다.

셀프 호스팅 배포에 대해서는 다음을 참조하세요 [Roboflow Inference](https://docs.roboflow.com/deployment/self-hosted/self-hosted).

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

## 코드 샘플

{% stepper %}
{% step %}

### API 키 받기

Roboflow 계정을 생성하고, 다음에서 키를 찾으세요 [Roboflow API 설정 페이지](https://app.roboflow.com/settings/api) 그리고 셸에서 사용할 수 있게 하세요:

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

{% endstep %}

{% step %}

### 종속성을 설치하세요

다음을 설치하세요 [Inference SDK](https://docs.roboflow.com/reference/inference/inference-sdk) 및 [supervision](https://supervision.roboflow.com/) 예측을 디코딩하고 시각화하기 위해:

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

{% endstep %}

{% step %}

### 모델 실행

이 예시는 다음으로 학습된 공개 YOLOv12 모델을 실행합니다 [나사 데이터셋](https://universe.roboflow.com/erik-pe6au/rf-bolts) (screw, flat-washer, hex-nut). 자신의 것으로 바꾸세요 `{workspace}/{model-slug}` 학습한 가중치를 실행하려면(다음을 참조하세요 [버전, 학습 및 모델](/models/ko/versions-trainings-and-models.md)).

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

image = sv.load_image_from_url("https://media.roboflow.com/docs/bolts.jpg")

client = InferenceHTTPClient(
    api_url="https://serverless.roboflow.com",
    api_key=os.environ["ROBOFLOW_API_KEY"],
)
result = client.infer(image, model_id="erik-pe6au/bolts-uzqzc-4-yolo12s-t1")

detections = sv.Detections.from_inference(result)

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

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

<figure><img src="/files/ad1d01b48470e86a7c25482b9a7033d08ad1d546" 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 %}
