hassonofer commited on
Commit
e818982
·
verified ·
1 Parent(s): c9c3f86

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +105 -3
README.md CHANGED
@@ -1,3 +1,105 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - image-classification
4
+ - birder
5
+ library_name: birder
6
+ license: apache-2.0
7
+ ---
8
+
9
+ # Model Card for regnet_y_8g_intermediate-eu-common
10
+
11
+ RegNet Y image classification model. The model follows a two-stage training process: first undergoing intermediate training on a large-scale dataset containing diverse bird species from around the world, then fine-tuned specifically on the `eu-common` dataset containing common European bird species.
12
+
13
+ The species list is derived from the Collins bird guide [^1].
14
+
15
+ [^1]: Svensson, L., Mullarney, K., & Zetterström, D. (2022). Collins bird guide (3rd ed.). London, England: William Collins.
16
+
17
+ ## Model Details
18
+
19
+ - **Model Type:** Image classification and detection backbone
20
+ - **Model Stats:**
21
+ - Params (M): 38.8
22
+ - Input image size: 384 x 384
23
+ - **Dataset:** eu-common (708 classes)
24
+
25
+ - **Papers:**
26
+ - Designing Network Design Spaces: <https://arxiv.org/abs/2003.13678>
27
+
28
+ ## Model Usage
29
+
30
+ ### Image Classification
31
+
32
+ ```python
33
+ import birder
34
+ from birder.inference.classification import infer_image
35
+
36
+ (net, class_to_idx, signature, rgb_stats) = birder.load_pretrained_model("regnet_y_8g_intermediate-eu-common", inference=True)
37
+
38
+ # Get the image size the model was trained on
39
+ size = birder.get_size_from_signature(signature)
40
+
41
+ # Create an inference transform
42
+ transform = birder.classification_transform(size, rgb_stats)
43
+
44
+ image = "path/to/image.jpeg" # or a PIL image
45
+ (out, _) = infer_image(net, image, transform)
46
+ # out is a NumPy array with shape of (1, num_classes)
47
+ ```
48
+
49
+ ### Image Embeddings
50
+
51
+ ```python
52
+ import birder
53
+ from birder.inference.classification import infer_image
54
+
55
+ (net, class_to_idx, signature, rgb_stats) = birder.load_pretrained_model("regnet_y_8g_intermediate-eu-common", inference=True)
56
+
57
+ # Get the image size the model was trained on
58
+ size = birder.get_size_from_signature(signature)
59
+
60
+ # Create an inference transform
61
+ transform = birder.classification_transform(size, rgb_stats)
62
+
63
+ image = "path/to/image.jpeg" # or a PIL image
64
+ (out, embedding) = infer_image(net, image, transform, return_embedding=True)
65
+ # embedding is a NumPy array with shape of (1, embedding_size)
66
+ ```
67
+
68
+ ### Detection Feature Map
69
+
70
+ ```python
71
+ from PIL import Image
72
+ import birder
73
+
74
+ (net, class_to_idx, signature, rgb_stats) = birder.load_pretrained_model("regnet_y_8g_intermediate-eu-common", inference=True)
75
+
76
+ # Get the image size the model was trained on
77
+ size = birder.get_size_from_signature(signature)
78
+
79
+ # Create an inference transform
80
+ transform = birder.classification_transform(size, rgb_stats)
81
+
82
+ image = Image.open("path/to/image.jpeg")
83
+ features = net.detection_features(transform(image).unsqueeze(0))
84
+ # features is a dict (stage name -> torch.Tensor)
85
+ print([(k, v.size()) for k, v in features.items()])
86
+ # Output example:
87
+ # [('stage1', torch.Size([1, 96, 96, 96])),
88
+ # ('stage2', torch.Size([1, 192, 48, 48])),
89
+ # ('stage3', torch.Size([1, 384, 24, 24])),
90
+ # ('stage4', torch.Size([1, 768, 12, 12]))]
91
+ ```
92
+
93
+ ## Citation
94
+
95
+ ```bibtex
96
+ @misc{radosavovic2020designingnetworkdesignspaces,
97
+ title={Designing Network Design Spaces},
98
+ author={Ilija Radosavovic and Raj Prateek Kosaraju and Ross Girshick and Kaiming He and Piotr Dollár},
99
+ year={2020},
100
+ eprint={2003.13678},
101
+ archivePrefix={arXiv},
102
+ primaryClass={cs.CV},
103
+ url={https://arxiv.org/abs/2003.13678},
104
+ }
105
+ ```