adirik commited on
Commit
797638f
1 Parent(s): 213ee3a

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +85 -0
README.md ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ tags:
4
+ - vision
5
+ datasets:
6
+ - imagenet-21k
7
+ inference: false
8
+ ---
9
+
10
+ # Vision Transformer (large-sized model)
11
+
12
+ Vision Transformer (ViT) model pre-trained on ImageNet-21k (14 million images, 21,843 classes) at resolution 512x512. It was introduced in the paper [An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale](https://arxiv.org/abs/2010.11929) by Dosovitskiy et al. and first released in [this repository](https://github.com/google-research/vision_transformer). However, this model is contributed by the Kakao Brain team and the weights were converted from their TensorFlow implementation to PyTorch by Alara Dirik.
13
+
14
+
15
+ ## Model description
16
+
17
+ The Vision Transformer (ViT) is a transformer encoder model (BERT-like) pretrained on a large collection of images in a supervised fashion, namely ImageNet-21k, at a resolution of 512x512 pixels.
18
+
19
+ Images are presented to the model as a sequence of fixed-size patches (resolution 16x16), which are linearly embedded. One also adds a [CLS] token to the beginning of a sequence to use it for classification tasks. One also adds absolute position embeddings before feeding the sequence to the layers of the Transformer encoder.
20
+
21
+ Note that this model is contributed by Kakao Brain and trained on the downstream image classification task.
22
+
23
+
24
+ ## Intended uses & limitations
25
+
26
+ You can use the raw model for image classification. See the [model hub](https://huggingface.co/models?search=google/vit) to look for
27
+ fine-tuned versions on a task that interests you.
28
+
29
+ ### How to use
30
+
31
+ Here is how to use this model in PyTorch:
32
+
33
+ ```python
34
+ from transformers import ViTImageProcessor, ViTForImageClassification
35
+ from PIL import Image
36
+ import requests
37
+
38
+ url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
39
+ image = Image.open(requests.get(url, stream=True).raw)
40
+
41
+ processor = ViTImageProcessor.from_pretrained('kakaobrain/vit-large-patch16-512')
42
+ model = ViTForImageClassification.from_pretrained('kakaobrain/vit-large-patch16-512')
43
+
44
+ inputs = processor(images=image, return_tensors="pt")
45
+ outputs = model(**inputs)
46
+ logits = outputs.logits
47
+ ```
48
+
49
+ Refer to the [docs](https://huggingface.co/docs/transformers/model_doc/vit) for usage in TensorFlow and JAX/FLAX.
50
+
51
+ ## Training data
52
+
53
+ The ViT model was pretrained on [ImageNet-21k](http://www.image-net.org/), a dataset consisting of 14 million images and 21k classes.
54
+
55
+ ## Training procedure
56
+
57
+ ### Preprocessing
58
+
59
+ The exact details of preprocessing of images during training/validation can be found [here](https://github.com/google-research/vision_transformer/blob/master/vit_jax/input_pipeline.py).
60
+
61
+ Images are resized/rescaled to the same resolution (512x512) and normalized across the RGB channels with mean (0.5, 0.5, 0.5) and standard deviation (0.5, 0.5, 0.5).
62
+
63
+ ### BibTeX entry and citation info
64
+
65
+ ```bibtex
66
+ @misc{wu2020visual,
67
+ title={Visual Transformers: Token-based Image Representation and Processing for Computer Vision},
68
+ author={Bichen Wu and Chenfeng Xu and Xiaoliang Dai and Alvin Wan and Peizhao Zhang and Zhicheng Yan and Masayoshi Tomizuka and Joseph Gonzalez and Kurt Keutzer and Peter Vajda},
69
+ year={2020},
70
+ eprint={2006.03677},
71
+ archivePrefix={arXiv},
72
+ primaryClass={cs.CV}
73
+ }
74
+ ```
75
+
76
+ ```bibtex
77
+ @inproceedings{deng2009imagenet,
78
+ title={Imagenet: A large-scale hierarchical image database},
79
+ author={Deng, Jia and Dong, Wei and Socher, Richard and Li, Li-Jia and Li, Kai and Fei-Fei, Li},
80
+ booktitle={2009 IEEE conference on computer vision and pattern recognition},
81
+ pages={248--255},
82
+ year={2009},
83
+ organization={Ieee}
84
+ }
85
+ ```