egrace479 commited on
Commit
85baf1d
1 Parent(s): 2852fba

Add Model card

Browse files
Files changed (1) hide show
  1. README.md +281 -3
README.md CHANGED
@@ -1,8 +1,286 @@
1
  ---
 
 
 
 
2
  tags:
3
  - zero-shot-image-classification
4
  - clip
5
- library_tag: open_clip
6
- license: mit
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  ---
8
- # Model card for bioclip
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ license: mit
3
+ language:
4
+ - en
5
+ library_name: open_clip
6
  tags:
7
  - zero-shot-image-classification
8
  - clip
9
+ - biology
10
+ - CV
11
+ - images
12
+ - animals
13
+ - species
14
+ - taxonomy
15
+ - rare species
16
+ - endangered species
17
+ - evolutionary biology
18
+ - multimodal
19
+ - knowledge-guided
20
+ datasets:
21
+ - TreeOfLife-10M
22
+ - iNat21
23
+ - BIOSCAN-1M
24
  ---
25
+
26
+
27
+ # Model Card for BioCLIP
28
+
29
+ <!--
30
+ This modelcard has been generated using [this raw template](https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/templates/modelcard_template.md?plain=1). And further altered to suit Imageomics Institute needs -->
31
+
32
+ BioCLIP is a foundation model for the tree of life, built using CLIP architecture as a vision model for general organismal biology.
33
+ It is trained on [TreeOfLife-10M](https://huggingface.co/datasets/imageomics/TreeOfLife-10M), our specially-created dataset covering over 450K taxa--the most biologically diverse ML-ready dataset available to date.
34
+ Through rigorous benchmarking on a diverse set of fine-grained biological classification tasks, BioCLIP consistently outperformed existing baselines by 17% to 20% absolute.
35
+ Through intrinsic evaluation, we found that BioCLIP learned a hierarchical representation aligned to the tree of life, which demonstrates its potential for robust generalizability.
36
+
37
+ ## Model Details
38
+
39
+ ### Model Description
40
+
41
+ BioCLIP is based on OpenAI's [CLIP](https://openai.com/research/clip).
42
+ We trained the model on [TreeOfLife-10M](https://huggingface.co/datasets/imageomics/TreeOfLife-10M) from OpenAI's ViT-B/16 checkpoint, using [OpenCLIP's](https://github.com/mlfoundations/open_clip) code.
43
+ BioCLIP is trained with the standard CLIP objective to imbue the model with an understanding, not just of different species, but of the hierarchical structure that relates species across the tree of life.
44
+ In this way, BioCLIP offers potential to aid biologists in discovery of new and related creatures, since it does not see the 454K different taxa as distinct classes, but as part of an interconnected hierarchy.
45
+
46
+
47
+ - **Developed by:** Samuel Stevens, Jiaman Wu, Matthew J. Thompson, Elizabeth G. Campolongo, Chan Hee Song, David Edward Carlyn, Li Dong, Wasila M. Dahdul, Charles Stewart, Tanya Berger-Wolf, Wei-Lun Chao, and Yu Su
48
+ - **Model type:** Vision Transformer (ViT-B/16)
49
+ - **License:** MIT
50
+ - **Fine-tuned from model:** OpenAI CLIP, ViT-B/16
51
+
52
+ ### Model Sources
53
+
54
+ - **Repository:** [BioCLIP](https://github.com/Imageomics/BioCLIP)
55
+ - **Paper:** Coming Soon
56
+ - **Demo:** [BioCLIP Demo](https://huggingface.co/spaces/imageomics/BioCLIP)
57
+
58
+ ## Uses
59
+
60
+ BioCLIP has been extensively evaluated on species classification tasks across many different subtrees of the tree of life.
61
+ The ViT-B/16 vision encoder is recommended as a base model for any computer vision task for biology; we expect it to outperform general domain models with the same architecture on biology-specific tasks.
62
+
63
+
64
+ ### Direct Use
65
+
66
+ See the demo [here](https://huggingface.co/spaces/imageomics/BioCLIP) for examples of zero-shot classification.
67
+ It can also be used in a few-shot setting with a KNN; please see [our paper]() for details for both few-shot and zero-shot settings without fine-tuning.
68
+
69
+
70
+ ## Bias, Risks, and Limitations
71
+
72
+ This model was developed from the original CLIP model, thus many of the concerns discussed in ([Radford et al. 2021](https://proceedings.mlr.press/v139/radford21a/radford21a.pdf)) apply.
73
+ We encourage the concerned/curious user to read their extensive ethics statement, while we focus our attention on the biological perspective which is unique to BioCLIP.
74
+ - No specific geographic information (eg., GPS coordinates) are included in training, so the species classification does not pose a direct threat to animals through aiding poachers, as it cannot inform them of their location.
75
+ - BioCLIP is designed to aid in scientific discovery through an association of images to the hierarchical taxonomy structure. As with many--if not all--models currently in production, it is important to retain the context that it is meant to assist biologists in their work, not replace them. As such, we caution against over-reliance on model predictions.
76
+
77
+ ### Recommendations
78
+
79
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model.
80
+ More information needed for further recommendations.
81
+
82
+ ## How to Get Started with the Model
83
+
84
+ BioCLIP can be used with the `open_clip` library:
85
+
86
+ ```py
87
+ import open_clip
88
+
89
+ model, preprocess_train, preprocess_val = open_clip.create_model_and_transforms('hf-hub:imageomics/bioclip')
90
+ tokenizer = open_clip.get_tokenizer('hf-hub:imageomics/bioclip')
91
+ ```
92
+
93
+ ## Training Details
94
+
95
+ ### Compute Infrastructure
96
+
97
+ Training was performed on 8 NVIDIA A100-80GB GPUs distributed over 2 nodes on [OSC's](https://www.osc.edu/) Ascend HPC Cluster with global batch size 32,768 for 4 days.
98
+
99
+ Based on [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://doi.org/10.48550/arXiv.1910.09700), that's 132.71 kg of CO<sub>2</sub> eq., or 536km driven by an average ICE car.
100
+
101
+ ### Training Data
102
+
103
+ This model was trained on [TreeOfLife-10M](https://huggingface.co/datasets/imageomics/TreeOfLife-10M), which is a compilation of images matched to [Linnaean taxonomic rank](https://www.britannica.com/science/taxonomy/The-objectives-of-biological-classification) from kingdom through species. They are also matched with common (vernacular) name of the subject of the image where available. For more information, please see our dataset, [TreeOfLife-10M](https://huggingface.co/datasets/imageomics/TreeOfLife-10M).
104
+
105
+ ### Training Hyperparameters
106
+
107
+ - **Training regime:** fp16 mixed precision.
108
+
109
+ We resize images to 224 x 224 pixels.
110
+ We use a maximum learning rate of 1e4 with 1000 linear warm-up steps, then use cosine decay to 0 over 100 epochs.
111
+ We also use a weight decay of 0.2 and a batch size of 32K.
112
+
113
+ ## Evaluation
114
+
115
+ ### Testing Data
116
+
117
+ We tested BioCLIP on the following collection of 10 biologically-relevant tasks.
118
+ - [Meta-Album](https://paperswithcode.com/dataset/meta-album): Specifically, we used the Plankton, Insects, Insects 2, PlantNet, Fungi, PlantVillage, Medicinal Leaf, and PlantDoc datasets from Set-0 through Set-2 (Set-3 was still not released as of our publication/evaluation (Nov. 2023).
119
+ - [Birds 525](https://www.kaggle.com/datasets/gpiosenka/100-bird-species): We evaluated on the 2,625 test images provided with the dataset.
120
+ - [Rare Species](https://huggingface.co/datasets/imageomics/rare-species): A new dataset we curated for the purpose of testing this model and to contribute to the ML for Conservation community. It consists of 400 species labeled Near Threatened through Extinct in the Wild by the [IUCN Red List](https://www.iucnredlist.org/), with 30 images per species. For more information, see our dataset, [Rare Species](https://huggingface.co/datasets/imageomics/rare-species).
121
+
122
+ For more information about the contents of these datasets, see Table 2 and associated sections of [our paper]().
123
+
124
+ ### Metrics
125
+
126
+ We use top-1 and top-5 accuracy to evaluate models, and validation loss to choose the best performing checkpoints from training.
127
+
128
+ ### Results
129
+
130
+ We compare BioCLIP to OpenAI's CLIP and OpenCLIP's LAION-2B checkpoint.
131
+ Here are the zero-shot classification results on our benchmark tasks.
132
+ Please see [our paper]() for few-shot results.
133
+
134
+ <table cellpadding="0" cellspacing="0">
135
+ <thead>
136
+ <tr>
137
+ <th rowspan="2">Model</th>
138
+ <th colspan="4">Animals</th>
139
+ <th colspan="5">Plants & Fungi</th>
140
+ <th rowspan="2">Rare Species</th>
141
+ <th rowspan="2">Mean</th>
142
+ </tr>
143
+ <tr>
144
+ <th>Birds 525</th>
145
+ <th>Plankton</th>
146
+ <th>Insects</th>
147
+ <th>Insects 2</th>
148
+ <th>PlantNet</th>
149
+ <th>Fungi</th>
150
+ <th>PlantVillage</th>
151
+ <th>Med. Leaf</th>
152
+ <th>PlantDoc</th>
153
+ </tr>
154
+ </thead>
155
+ <tbody>
156
+ <tr>
157
+ <td>CLIP</td>
158
+ <td>49.9</td>
159
+ <td>3.2</td>
160
+ <td>9.1</td>
161
+ <td>9.8</td>
162
+ <td>58.5</td>
163
+ <td>10.2</td>
164
+ <td>5.4</td>
165
+ <td>15.9</td>
166
+ <td>26.1</td>
167
+ <td>26.6</td>
168
+ <td>21.4</td>
169
+ </tr>
170
+ <tr>
171
+ <td>OpenCLIP</td>
172
+ <td>54.7</td>
173
+ <td>2.2</td>
174
+ <td>6.5</td>
175
+ <td>9.6</td>
176
+ <td>50.2</td>
177
+ <td>5.7</td>
178
+ <td>8.0</td>
179
+ <td>12.4</td>
180
+ <td>25.8</td>
181
+ <td>31.0</td>
182
+ <td>20.6</td>
183
+ </tr>
184
+ <tr>
185
+ <td>BioCLIP</td>
186
+ <td><b>74.7</b></td>
187
+ <td><b>5.4</b></td>
188
+ <td><b>32.7</b></td>
189
+ <td><b>21.2</b></td>
190
+ <td><b>91.0</b></td>
191
+ <td><b>51.8</b></td>
192
+ <td><b>24.0</b></td>
193
+ <td><b>48.1</b></td>
194
+ <td><b>27.5</b></td>
195
+ <td><b>39.2</b></td>
196
+ <td><b>41.5</b></td>
197
+ </tr>
198
+ <tr>
199
+ <td>iNat21 Only</td>
200
+ <td>55.7</td>
201
+ <td>2.7</td>
202
+ <td>29.9</td>
203
+ <td>12.0</td>
204
+ <td>89.3</td>
205
+ <td>42.7</td>
206
+ <td>16.4</td>
207
+ <td>22.2</td>
208
+ <td>18.8</td>
209
+ <td>19.4</td>
210
+ <td>30.9</td>
211
+ </tr>
212
+ </tbody>
213
+ </table>
214
+
215
+
216
+ ### Summary
217
+
218
+ BioCLIP outperforms general-domain baselines by 18% on average.
219
+
220
+ ### Model Examination
221
+
222
+ We encourage readers to see Section 4.6 of [our paper]().
223
+ In short, BioCLIP forms representations that more closely align to the taxonomic hierarchy compared to general-domain baselines like CLIP or OpenCLIP.
224
+
225
+
226
+ ## Citation
227
+
228
+ **BibTeX:**
229
+
230
+ ```
231
+ @software{bioclip2023,
232
+ author = {Samuel Stevens and Jiaman Wu and Matthew J. Thompson and Elizabeth G. Campolongo and Chan Hee Song and David Edward Carlyn and Li Dong and Wasila M. Dahdul and Charles Stewart and Tanya Berger-Wolf and Wei-Lun Chao and Yu Su},
233
+ doi = {<doi once generated>},
234
+ month = nov,
235
+ title = {BioCLIP},
236
+ version = {v0.1},
237
+ year = {2023}
238
+ }
239
+ ```
240
+
241
+ Please also cite our paper: (Coming Soon)
242
+ <!--
243
+ ```
244
+ @article{stevens2023bioclip,
245
+ title = "BioCLIP: A Vision Foundation Model for the Tree of Life",
246
+ author = "Samuel Stevens and Jiaman Wu and Matthew J. Thompson and Elizabeth G. Campolongo and Chan Hee Song and David Edward Carlyn and Li Dong and Wasila M. Dahdul and Charles Stewart and Tanya Berger-Wolf and Wei-Lun Chao and Yu Su",
247
+ journal = "<journal_name>",
248
+ year = <year>,
249
+ url = "<DOI_URL>",
250
+ doi = "<DOI>"
251
+ }
252
+ ```
253
+ -->
254
+
255
+ Please also cite OpenCLIP:
256
+ ```
257
+ @software{ilharco2021openclip,
258
+ author = {Ilharco, Gabriel and Wortsman, Mitchell and Wightman, Ross and Gordon, Cade and Carlini, Nicholas and Taori, Rohan and Dave, Achal and Shankar, Vaishaal and Namkoong, Hongseok and Miller, John and Hajishirzi, Hannaneh and Farhadi, Ali and Schmidt, Ludwig},
259
+ doi = {10.5281/zenodo.5143773},
260
+ month = jul,
261
+ title = {{OpenCLIP}},
262
+ version = {v0.1},
263
+ year = {2021}
264
+ }
265
+ ```
266
+
267
+ **APA:**
268
+
269
+ Stevens, S, Wu, J., Thompson, M. J., Campolongo, E. G., Song, C. H., Carlyn, D. E., Dong, L., Dahdul, W. M., Stewart, C., Berger-Wolf, T., Chao, W.L., & Su, Y. (2023) BioCLIP (Version v0.1) [Computer software]. https://doi.org/
270
+
271
+ Please also cite OpenCLIP:
272
+
273
+ Ilharco, G., Wortsman, M., Wightman, R., Gordon, C., Carlini, N., Taori, R., Dave, A., Shankar, V., Namkoong, H., Miller, J., Hajishirzi, H., Farhadi, A., & Schmidt, L. (2021). OpenCLIP (Version v0.1) [Computer software]. https://doi.org/10.5281/zenodo.5143773
274
+
275
+ ## Acknowledgements
276
+
277
+ The [Imageomics Institute](https://imageomics.org) is funded by the US National Science Foundation's Harnessing the Data Revolution (HDR) Institute program under [Award #2118240](https://www.nsf.gov/awardsearch/showAward?AWD_ID=2118240) (Imageomics: A New Frontier of Biological Information Powered by Knowledge-Guided Machine Learning).
278
+
279
+
280
+ ## Model Card Authors
281
+
282
+ Elizabeth G. Campolongo, Samuel Stevens, and Jiaman Wu
283
+
284
+ ## Model Card Contact
285
+
286
+ [stevens.994@osu.edu](mailto:stevens.994@osu.edu)