nielsr HF staff commited on
Commit
21534c7
1 Parent(s): f7d4d52

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +26 -3
README.md CHANGED
@@ -1,4 +1,26 @@
1
- ### How to use
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes:
4
 
@@ -10,8 +32,8 @@ import requests
10
  url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
11
  image = Image.open(requests.get(url, stream=True).raw)
12
 
13
- feature_extractor = AutoFeatureExtractor.from_pretrained('anugunj/cvt-21')
14
- model = CvtForImageClassification.from_pretrained('anugunj/cvt-21')
15
 
16
  inputs = feature_extractor(images=image, return_tensors="pt")
17
  outputs = model(**inputs)
@@ -19,4 +41,5 @@ logits = outputs.logits
19
  # model predicts one of the 1000 ImageNet classes
20
  predicted_class_idx = logits.argmax(-1).item()
21
  print("Predicted class:", model.config.id2label[predicted_class_idx])
 
22
  ```
 
1
+ ---
2
+ license: apache-2.0
3
+ tags:
4
+ - vision
5
+ - image-classification
6
+ datasets:
7
+ - imagenet-1k
8
+ widget:
9
+ - src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/tiger.jpg
10
+ example_title: Tiger
11
+ - src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/teapot.jpg
12
+ example_title: Teapot
13
+ - src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/palace.jpg
14
+ example_title: Palace
15
+ ---
16
+
17
+ # Convolutional Vision Transformer (CvT)
18
+
19
+ CvT-21 model pre-trained on ImageNet-1k at resolution 224x224. It was introduced in the paper [CvT: Introducing Convolutions to Vision Transformers](https://arxiv.org/abs/2103.15808) by Wu et al. and first released in [this repository](https://github.com/microsoft/CvT).
20
+
21
+ Disclaimer: The team releasing CvT did not write a model card for this model so this model card has been written by the Hugging Face team.
22
+
23
+ ## Usage
24
 
25
  Here is how to use this model to classify an image of the COCO 2017 dataset into one of the 1,000 ImageNet classes:
26
 
 
32
  url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
33
  image = Image.open(requests.get(url, stream=True).raw)
34
 
35
+ feature_extractor = AutoFeatureExtractor.from_pretrained('microsoft/cvt-21')
36
+ model = CvtForImageClassification.from_pretrained('microsoft/cvt-21')
37
 
38
  inputs = feature_extractor(images=image, return_tensors="pt")
39
  outputs = model(**inputs)
 
41
  # model predicts one of the 1000 ImageNet classes
42
  predicted_class_idx = logits.argmax(-1).item()
43
  print("Predicted class:", model.config.id2label[predicted_class_idx])
44
+ ```
45
  ```