kehanlyu commited on
Commit
3939977
·
verified ·
1 Parent(s): 81c80aa

Upload 5 files

Browse files
Files changed (5) hide show
  1. README.md +61 -3
  2. config.json +24 -0
  3. model.safetensors +3 -0
  4. preprocessor_config.json +27 -0
  5. pytorch_model.bin +3 -0
README.md CHANGED
@@ -1,3 +1,61 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ tags:
4
+ - dino
5
+ - vision
6
+ inference: false
7
+ ---
8
+
9
+ # Vision Transformer (base-sized model) trained using DINOv2
10
+
11
+ Vision Transformer (ViT) model trained using the DINOv2 method. It was introduced in the paper [DINOv2: Learning Robust Visual Features without Supervision](https://arxiv.org/abs/2304.07193) by Oquab et al. and first released in [this repository](https://github.com/facebookresearch/dinov2).
12
+
13
+ Disclaimer: The team releasing DINOv2 did not write a model card for this model so this model card has been written by the Hugging Face team.
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 self-supervised fashion.
18
+
19
+ Images are presented to the model as a sequence of fixed-size patches, 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 does not include any fine-tuned heads.
22
+
23
+ By pre-training the model, it learns an inner representation of images that can then be used to extract features useful for downstream tasks: if you have a dataset of labeled images for instance, you can train a standard classifier by placing a linear layer on top of the pre-trained encoder. One typically places a linear layer on top of the [CLS] token, as the last hidden state of this token can be seen as a representation of an entire image.
24
+
25
+ ## Intended uses & limitations
26
+
27
+ You can use the raw model for feature extraction. See the [model hub](https://huggingface.co/models?search=facebook/dinov2) 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:
33
+
34
+ ```python
35
+ from transformers import AutoImageProcessor, AutoModel
36
+ from PIL import Image
37
+ import requests
38
+
39
+ url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
40
+ image = Image.open(requests.get(url, stream=True).raw)
41
+
42
+ processor = AutoImageProcessor.from_pretrained('facebook/dinov2-base')
43
+ model = AutoModel.from_pretrained('facebook/dinov2-base')
44
+
45
+ inputs = processor(images=image, return_tensors="pt")
46
+ outputs = model(**inputs)
47
+ last_hidden_states = outputs.last_hidden_state
48
+ ```
49
+
50
+ ### BibTeX entry and citation info
51
+
52
+ ```bibtex
53
+ misc{oquab2023dinov2,
54
+ title={DINOv2: Learning Robust Visual Features without Supervision},
55
+ author={Maxime Oquab and Timothée Darcet and Théo Moutakanni and Huy Vo and Marc Szafraniec and Vasil Khalidov and Pierre Fernandez and Daniel Haziza and Francisco Massa and Alaaeldin El-Nouby and Mahmoud Assran and Nicolas Ballas and Wojciech Galuba and Russell Howes and Po-Yao Huang and Shang-Wen Li and Ishan Misra and Michael Rabbat and Vasu Sharma and Gabriel Synnaeve and Hu Xu and Hervé Jegou and Julien Mairal and Patrick Labatut and Armand Joulin and Piotr Bojanowski},
56
+ year={2023},
57
+ eprint={2304.07193},
58
+ archivePrefix={arXiv},
59
+ primaryClass={cs.CV}
60
+ }
61
+ ```
config.json ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Dinov2Model"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.0,
6
+ "drop_path_rate": 0.0,
7
+ "hidden_act": "gelu",
8
+ "hidden_dropout_prob": 0.0,
9
+ "hidden_size": 768,
10
+ "image_size": 518,
11
+ "initializer_range": 0.02,
12
+ "layer_norm_eps": 1e-06,
13
+ "layerscale_value": 1.0,
14
+ "mlp_ratio": 4,
15
+ "model_type": "dinov2",
16
+ "num_attention_heads": 12,
17
+ "num_channels": 3,
18
+ "num_hidden_layers": 12,
19
+ "patch_size": 14,
20
+ "qkv_bias": true,
21
+ "torch_dtype": "float32",
22
+ "transformers_version": "4.31.0.dev0",
23
+ "use_swiglu_ffn": false
24
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d73036b56966966d07975d696bde331762f37297e2f095de8cea0040c3aa0841
3
+ size 346345912
preprocessor_config.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "crop_size": {
3
+ "height": 224,
4
+ "width": 224
5
+ },
6
+ "do_center_crop": true,
7
+ "do_convert_rgb": true,
8
+ "do_normalize": true,
9
+ "do_rescale": true,
10
+ "do_resize": true,
11
+ "image_mean": [
12
+ 0.485,
13
+ 0.456,
14
+ 0.406
15
+ ],
16
+ "image_processor_type": "BitImageProcessor",
17
+ "image_std": [
18
+ 0.229,
19
+ 0.224,
20
+ 0.225
21
+ ],
22
+ "resample": 3,
23
+ "rescale_factor": 0.00392156862745098,
24
+ "size": {
25
+ "shortest_edge": 256
26
+ }
27
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:014965d9e330e7f4bff8ddcbee9df5e4f2ca032b2f5180942a6edb454783e75d
3
+ size 346392713