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

# ResNet

다음을 통해 ImageNet 사전학습 ResNet 이미지 분류를 실행 [Serverless Hosted API](/roboflow/roboflow-ko/deploy/serverless-hosted-api-v2.md), 또는 다음을 사용해 자체 호스팅 [Roboflow Inference](https://inference.roboflow.com/).

## 기본 alias

이 별칭들 중 아무거나 다음으로 전달하세요: `model_id` 사용할 때 [inference-sdk](/roboflow/roboflow-ko/deploy/serverless-hosted-api-v2/use-with-python-sdk.md):

* `resnet18`
* `resnet34`
* `resnet50`
* `resnet101`

## 정확도 및 추론 속도

지연 시간은 다음을 사용해 측정됩니다 [Roboflow Inference](https://inference.roboflow.com/) 1x NVIDIA L4, 배치 크기 1에서, 1,000회 추론(100회 워밍업)의 평균으로 측정됩니다. 이 별칭들은 ONNX에서 실행됩니다(사전 빌드된 TensorRT 엔진 없음). 배치 처리로는 도움이 되지 않습니다: 이 체크포인트는 고정된 배치 차원 1로 내보내집니다.

정확도는 표준 torchvision 가중치의 공개된 ImageNet-1k 사양입니다 ([출처](https://pytorch.org/vision/stable/models.html)).

<table data-search="false"><thead><tr><th>별칭</th><th>Top-1</th><th>Top-5</th><th>지연 시간(ms)</th></tr></thead><tbody><tr><td><code>resnet18</code></td><td>69.8</td><td>89.1</td><td>1.4</td></tr><tr><td><code>resnet34</code></td><td>73.3</td><td>91.4</td><td>2.2</td></tr><tr><td><code>resnet50</code></td><td>76.1</td><td>92.9</td><td>2.4</td></tr><tr><td><code>resnet101</code></td><td>77.4</td><td>93.5</td><td>3.7</td></tr></tbody></table>

## 코드 샘플

{% stepper %}
{% step %}

### API Key를 받으세요

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

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

{% endstep %}

{% step %}

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

이 패키지는 다음 모델을 호출합니다:

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

{% endstep %}

{% step %}

### 모델을 실행하세요

아래 예제는 실행합니다 `resnet50` 원격 이미지에 대해.

```python
import os
import cv2
import numpy as np
import requests
from inference_sdk import InferenceHTTPClient

content = requests.get("https://media.roboflow.com/notebooks/examples/dog.jpeg").content
image = cv2.imdecode(np.frombuffer(content, np.uint8), cv2.IMREAD_COLOR)

client = InferenceHTTPClient(
    api_url="https://serverless.roboflow.com",
    api_key=os.environ["ROBOFLOW_API_KEY"],
)
results = client.infer(image, model_id="resnet50")
print(results)
```

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

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

* `https://serverless.roboflow.com` Serverless Hosted API용입니다.
* `http://localhost:9001` 로컬 [Inference](https://inference.roboflow.com/) 서버용입니다.
* 귀하의 [Dedicated Deployment](/roboflow/roboflow-ko/deploy/dedicated-deployments.md) 비공개 엔드포인트용 URL입니다.
  {% endhint %}
