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

# ResNet

ImageNet-pretrained ResNet इमेज क्लासिफिकेशन को के माध्यम से चलाएँ [Serverless Hosted API](/roboflow/roboflow-hi/deploy/serverless-hosted-api-v2.md), या self-host using [Roboflow Inference](https://inference.roboflow.com/).

## डिफ़ॉल्ट उपनाम

इनमें से किसी भी alias को बतौर पास करें `model_id` का उपयोग करते समय [inference-sdk](/roboflow/roboflow-hi/deploy/serverless-hosted-api-v2/use-with-python-sdk.md):

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

## सटीकता और inference गति

Latency को मापा जाता है [Roboflow Inference](https://inference.roboflow.com/) 1x NVIDIA L4 पर, batch size 1, 1,000 inferences (100 warmup) के औसत के साथ। ये aliases ONNX पर चलते हैं (कोई prebuilt TensorRT engine नहीं)। Batching से मदद नहीं मिलती: ये checkpoints एक स्थिर batch dimension 1 के साथ export होते हैं।

Accuracy मानक torchvision weights ([स्रोत](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 खाता बनाएं, अपनी key यहाँ पर ढूँढें [Roboflow API settings page](https://app.roboflow.com/settings/api) और इसे अपने shell में उपलब्ध कराएँ:

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

{% endstep %}

{% step %}

### निर्भरताएँ इंस्टॉल करें

यह पैकेज मॉडल को कॉल करता है:

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

{% endstep %}

{% step %}

### मॉडल चलाएँ

नीचे दिया गया sample चलाता है `resnet50` एक remote image के विरुद्ध।

```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/9d6f8ad9e6414c04189cac37deba0658486d8e32" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

{% hint style="info" %}
सेट करें `api_url` को अपने deployment target से मिलाएँ:

* `https://serverless.roboflow.com` Serverless Hosted API के लिए।
* `http://localhost:9001` एक local [Inference](https://inference.roboflow.com/) server.
* आपका [Dedicated Deployment](/roboflow/roboflow-hi/deploy/dedicated-deployments.md) एक private endpoint के लिए URL.
  {% endhint %}
