Update README.md
Browse files
README.md
CHANGED
|
@@ -16,14 +16,51 @@ Model description in progress...
|
|
| 16 |
|
| 17 |
---
|
| 18 |
|
|
|
|
| 19 |
|
| 20 |
-
|
|
|
|
|
|
|
| 21 |
|
| 22 |
## Model description
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
## Intended uses & limitations
|
| 26 |
-
More information needed
|
| 27 |
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
---
|
| 18 |
|
| 19 |
+
ResNet-50 v1.5
|
| 20 |
|
| 21 |
+
ResNet model pre-trained on ImageNet-1k at resolution 224x224. It was introduced in the paper [Deep Residual Learning for Image Recognition](https://arxiv.org/abs/1512.03385) by He et al.
|
| 22 |
+
|
| 23 |
+
Disclaimer: The team releasing ResNet did not write a model card for this model so this model card has been written by the Hugging Face team.
|
| 24 |
|
| 25 |
## Model description
|
| 26 |
+
|
| 27 |
+
ResNet (Residual Network) is a convolutional neural network that democratized the concepts of residual learning and skip connections. This enables to train much deeper models.
|
| 28 |
+
|
| 29 |
+
This is ResNet v1.5, which differs from the original model: in the bottleneck blocks which require downsampling, v1 has stride = 2 in the first 1x1 convolution, whereas v1.5 has stride = 2 in the 3x3 convolution. This difference makes ResNet50 v1.5 slightly more accurate (\~0.5% top1) than v1, but comes with a small performance drawback (~5% imgs/sec) according to [Nvidia](https://catalog.ngc.nvidia.com/orgs/nvidia/resources/resnet_50_v1_5_for_pytorch).
|
| 30 |
+
|
| 31 |
+

|
| 32 |
|
| 33 |
## Intended uses & limitations
|
|
|
|
| 34 |
|
| 35 |
+
You can use the raw model for image classification. See the [model hub](https://huggingface.co/models?search=resnet) to look for
|
| 36 |
+
fine-tuned versions on a task that interests you.
|
| 37 |
+
|
| 38 |
+
### How to use
|
| 39 |
+
|
| 40 |
+
Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes:
|
| 41 |
+
|
| 42 |
+
```python
|
| 43 |
+
from transformers import AutoImageProcessor, ResNetForImageClassification
|
| 44 |
+
import torch
|
| 45 |
+
from datasets import load_dataset
|
| 46 |
+
|
| 47 |
+
dataset = load_dataset("huggingface/cats-image")
|
| 48 |
+
image = dataset["test"]["image"][0]
|
| 49 |
+
|
| 50 |
+
processor = AutoImageProcessor.from_pretrained("microsoft/resnet-50")
|
| 51 |
+
model = ResNetForImageClassification.from_pretrained("microsoft/resnet-50")
|
| 52 |
+
|
| 53 |
+
inputs = processor(image, return_tensors="pt")
|
| 54 |
+
|
| 55 |
+
with torch.no_grad():
|
| 56 |
+
logits = model(**inputs).logits
|
| 57 |
+
|
| 58 |
+
# model predicts one of the 1000 ImageNet classes
|
| 59 |
+
predicted_label = logits.argmax(-1).item()
|
| 60 |
+
print(model.config.id2label[predicted_label])
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
+
For more code examples, we refer to the [documentation](https://huggingface.co/docs/transformers/main/en/model_doc/resnet).
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
```
|