hassonofer commited on
Commit
edfa951
·
verified ·
1 Parent(s): f5e46a1

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +115 -3
README.md CHANGED
@@ -1,3 +1,115 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - image-classification
4
+ - birder
5
+ - pytorch
6
+ library_name: birder
7
+ license: apache-2.0
8
+ ---
9
+
10
+ # Model Card for vit_parallel_s16_18x2_ls_avg_data2vec-intermediate-eu-common
11
+
12
+ A ViT Parallel s16 18x2 image classification model. The model follows a three-stage training process: first, data2vec pretraining, next intermediate training on a large-scale dataset containing diverse bird species from around the world, finally fine-tuned specifically on the `eu-common` dataset containing common European bird species.
13
+
14
+ The species list is derived from the Collins bird guide [^1].
15
+
16
+ [^1]: Svensson, L., Mullarney, K., & Zetterström, D. (2022). Collins bird guide (3rd ed.). London, England: William Collins.
17
+
18
+ ## Model Details
19
+
20
+ - **Model Type:** Image classification and detection backbone
21
+ - **Model Stats:**
22
+ - Params (M): 64.7
23
+ - Input image size: 384 x 384
24
+ - **Dataset:** eu-common (707 classes)
25
+ - Intermediate training involved ~8000 species from all over the world
26
+
27
+ - **Papers:**
28
+ - Three things everyone should know about Vision Transformers: <https://arxiv.org/abs/2203.09795>
29
+ - data2vec: A General Framework for Self-supervised Learning in Speech, Vision and Language: <https://arxiv.org/abs/2202.03555>
30
+
31
+ ## Model Usage
32
+
33
+ ### Image Classification
34
+
35
+ ```python
36
+ import birder
37
+ from birder.inference.classification import infer_image
38
+
39
+ (net, model_info) = birder.load_pretrained_model("vit_parallel_s16_18x2_ls_avg_data2vec-intermediate-eu-common", inference=True)
40
+
41
+ # Get the image size the model was trained on
42
+ size = birder.get_size_from_signature(model_info.signature)
43
+
44
+ # Create an inference transform
45
+ transform = birder.classification_transform(size, model_info.rgb_stats)
46
+
47
+ image = "path/to/image.jpeg" # or a PIL image, must be loaded in RGB format
48
+ (out, _) = infer_image(net, image, transform)
49
+ # out is a NumPy array with shape of (1, 707), representing class probabilities.
50
+ ```
51
+
52
+ ### Image Embeddings
53
+
54
+ ```python
55
+ import birder
56
+ from birder.inference.classification import infer_image
57
+
58
+ (net, model_info) = birder.load_pretrained_model("vit_parallel_s16_18x2_ls_avg_data2vec-intermediate-eu-common", inference=True)
59
+
60
+ # Get the image size the model was trained on
61
+ size = birder.get_size_from_signature(model_info.signature)
62
+
63
+ # Create an inference transform
64
+ transform = birder.classification_transform(size, model_info.rgb_stats)
65
+
66
+ image = "path/to/image.jpeg" # or a PIL image
67
+ (out, embedding) = infer_image(net, image, transform, return_embedding=True)
68
+ # embedding is a NumPy array with shape of (1, 384)
69
+ ```
70
+
71
+ ### Detection Feature Map
72
+
73
+ ```python
74
+ from PIL import Image
75
+ import birder
76
+
77
+ (net, model_info) = birder.load_pretrained_model("vit_parallel_s16_18x2_ls_avg_data2vec-intermediate-eu-common", inference=True)
78
+
79
+ # Get the image size the model was trained on
80
+ size = birder.get_size_from_signature(model_info.signature)
81
+
82
+ # Create an inference transform
83
+ transform = birder.classification_transform(size, model_info.rgb_stats)
84
+
85
+ image = Image.open("path/to/image.jpeg")
86
+ features = net.detection_features(transform(image).unsqueeze(0))
87
+ # features is a dict (stage name -> torch.Tensor)
88
+ print([(k, v.size()) for k, v in features.items()])
89
+ # Output example:
90
+ # [('neck', torch.Size([1, 384, 24, 24]))]
91
+ ```
92
+
93
+ ## Citation
94
+
95
+ ```bibtex
96
+ @misc{touvron2022thingsknowvisiontransformers,
97
+ title={Three things everyone should know about Vision Transformers},
98
+ author={Hugo Touvron and Matthieu Cord and Alaaeldin El-Nouby and Jakob Verbeek and Hervé Jégou},
99
+ year={2022},
100
+ eprint={2203.09795},
101
+ archivePrefix={arXiv},
102
+ primaryClass={cs.CV},
103
+ url={https://arxiv.org/abs/2203.09795},
104
+ }
105
+
106
+ @misc{https://doi.org/10.48550/arxiv.2202.03555,
107
+ title={data2vec: A General Framework for Self-supervised Learning in Speech, Vision and Language},
108
+ author={Alexei Baevski and Wei-Ning Hsu and Qiantong Xu and Arun Babu and Jiatao Gu and Michael Auli},
109
+ year={2022},
110
+ eprint={2202.03555},
111
+ archivePrefix={arXiv},
112
+ primaryClass={cs.LG},
113
+ url={https://arxiv.org/abs/2202.03555},
114
+ }
115
+ ```