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

# ResNet

ImageNet 사전 학습 ResNet 이미지 분류를 통해 [서버리스 클라우드 API](https://docs.roboflow.com/deployment/roboflow-cloud/serverless-api)또는 다음을 사용해 자체 호스팅 [Roboflow Inference](https://docs.roboflow.com/deployment/self-hosted/self-hosted).

## ResNet 사전 학습 별칭

다음 별칭 중 하나를 `model_id` 다음을 사용할 때 [inference-sdk](https://docs.roboflow.com/deployment/roboflow-cloud/serverless-api#python-sdk):

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

## ResNet 정확도 및 추론 속도

지연 시간은 다음으로 측정됩니다 [Roboflow Inference](https://docs.roboflow.com/deployment/self-hosted/self-hosted) 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>

## ResNet API

{% stepper %}
{% step %}

### API 키 받기

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

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

{% endstep %}

{% step %}

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

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

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

{% endstep %}

{% step %}

### 모델 실행

아래 예제는 `resnet50` 원격 이미지에 대해.

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

image = sv.load_image_from_url("https://media.roboflow.com/notebooks/examples/dog.jpeg")

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

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