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

# YOLOv5

당사의 [서버리스 클라우드 API](https://docs.roboflow.com/deployment/roboflow-cloud/serverless-api) 및 자체 호스팅 [Inference](https://docs.roboflow.com/deployment/self-hosted/self-hosted). Roboflow에서는 YOLOv5 학습이 지원되지 않지만, 대신 [사전 학습된 가중치 업로드](/models/ko/model-weights/upload-custom-weights.md) (`model_type="yolov5"`)을 기존 프로젝트에 적용하고 어떤 배포 대상으로도 제공할 수 있습니다. Roboflow에서 학습된 검출기에 대해서는 [RF-DETR](/models/ko/supported-models/rf-detr.md), [YOLO26](/models/ko/supported-models/yolo26.md)또는 [YOLO11](/models/ko/supported-models/yolo11.md).

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

## YOLOv5 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 %}

### 모델 실행

다음 항목으로 바꾸세요 `{workspace}/{model-slug}` 업로드한 YOLOv5 모델의 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="your-workspace/your-model-slug")

detections = sv.Detections.from_inference(result)

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

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

{% 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 %}
