regisss HF staff commited on
Commit
5fec255
1 Parent(s): 8d711cf

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +67 -0
README.md ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ tags:
4
+ - vision
5
+ - image-classification
6
+ datasets:
7
+ - imagenet
8
+ - imagenet-1k
9
+ ---
10
+
11
+ # ResNet-50 v1.5
12
+
13
+ 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.
14
+
15
+ 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.
16
+
17
+ ## Model description
18
+
19
+ 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.
20
+
21
+ 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 smallperformance drawback (~5% imgs/sec) according to [Nvidia](https://catalog.ngc.nvidia.com/orgs/nvidia/resources/resnet_50_v1_5_for_pytorch).
22
+
23
+ ![model image](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/resnet_architecture.png)
24
+
25
+ ## Intended uses & limitations
26
+
27
+ You can use the raw model for image classification. See the [model hub](https://huggingface.co/models?search=resnet) to look for
28
+ fine-tuned versions on a task that interests you.
29
+
30
+ ### How to use
31
+
32
+ Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes:
33
+
34
+ ```python
35
+ from transformers import AutoFeatureExtractor, ResNetForImageClassification
36
+ import torch
37
+ from datasets import load_dataset
38
+
39
+ dataset = load_dataset("huggingface/cats-image")
40
+ image = dataset["test"]["image"][0]
41
+
42
+ feature_extractor = AutoFeatureExtractor.from_pretrained("microsoft/resnet-50")
43
+ model = ResNetForImageClassification.from_pretrained("microsoft/resnet-50")
44
+
45
+ inputs = feature_extractor(image, return_tensors="pt")
46
+
47
+ with torch.no_grad():
48
+ logits = model(**inputs).logits
49
+
50
+ # model predicts one of the 1000 ImageNet classes
51
+ predicted_label = logits.argmax(-1).item()
52
+ print(model.config.id2label[predicted_label])
53
+ ```
54
+
55
+ For more code examples, we refer to the [documentation](https://huggingface.co/docs/transformers/main/en/model_doc/resnet).
56
+
57
+ ### BibTeX entry and citation info
58
+
59
+ ```bibtex
60
+ @inproceedings{he2016deep,
61
+ title={Deep residual learning for image recognition},
62
+ author={He, Kaiming and Zhang, Xiangyu and Ren, Shaoqing and Sun, Jian},
63
+ booktitle={Proceedings of the IEEE conference on computer vision and pattern recognition},
64
+ pages={770--778},
65
+ year={2016}
66
+ }
67
+ ```