Initialize README (#1)
Browse files- Initialize README (db8eb3057cb6c80d22db0bc49dedcaf520476335)
Co-authored-by: Elizabeth Campolongo <egrace479@users.noreply.huggingface.co>
README.md
CHANGED
@@ -1,9 +1,341 @@
|
|
1 |
---
|
2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
4 |
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
-
|
|
|
1 |
---
|
2 |
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
tags:
|
6 |
+
- biology
|
7 |
+
- CV
|
8 |
+
- images
|
9 |
+
- animals
|
10 |
+
- image classification
|
11 |
+
- fine-grained classification
|
12 |
+
- butterflies
|
13 |
+
- birds
|
14 |
+
- interpretable
|
15 |
+
- transformers
|
16 |
+
- cross-attention
|
17 |
+
metrics:
|
18 |
---
|
19 |
|
20 |
+
<!--
|
21 |
+
|
22 |
+
NOTE: Add more tags (your particular animal, type of model and use-case, etc.).
|
23 |
+
|
24 |
+
Fill in as much information as you can at each location that says "More information needed".
|
25 |
+
-->
|
26 |
+
|
27 |
+
|
28 |
+
<!--
|
29 |
+
Image with caption:
|
30 |
+
|![Figure #](https://huggingface.co/imageomics/<model-repo>/resolve/main/<filename>)|
|
31 |
+
|:--|
|
32 |
+
|**Figure #.** [Image of <>](https://huggingface.co/imageomics/<model-repo>/raw/main/<filename>) <caption description>.|
|
33 |
+
-->
|
34 |
+
|
35 |
+
<!--
|
36 |
+
Notes on styling:
|
37 |
+
|
38 |
+
To render LaTex in your README, wrap the code in `\\(` and `\\)`. Example: \\(\frac{1}{2}\\)
|
39 |
+
|
40 |
+
Escape underscores ("_") with a "\". Example: image\_RGB
|
41 |
+
-->
|
42 |
+
|
43 |
+
# Model Card for INTR: A Simple Interpretable Transformer for Fine-grained Image Classification and Analysis
|
44 |
+
|
45 |
+
|
46 |
+
INTR checkpoint on CUB dataset with backbone DETR-R50 <!-- Also used Kaggle Birds and Cambridge Butterfly (should be noted as subset of images from the Butterfly Genetics Group, see https://huggingface.co/datasets/imageomics/Jiggins_Heliconius_Collection)
|
47 |
+
-->
|
48 |
+
|
49 |
+
<!-- This modelcard aims to be a base template for new models. It 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 -->
|
50 |
+
|
51 |
+
## Model Details
|
52 |
+
|
53 |
+
### Model Description
|
54 |
+
|
55 |
+
<!-- Provide a longer summary of what this model is. -->
|
56 |
+
|
57 |
+
- **Developed by:** Dipanjyoti Paul, Arpita Chowdhury, Xinqi Xiong, Feng-Ju Chang, David Carlyn, Samuel Stevens, Kaiya Provost, Anuj Karpatne, Bryan Carstens, Daniel Rubenstein, Charles Stewart, Tanya Berger-Wolf, Yu Su, and Wei-Lun Chao
|
58 |
+
- **Shared by [optional]:** [More Information Needed]
|
59 |
+
- **Model type:** [More Information Needed] <!-- Transformer -->
|
60 |
+
- **License:** Apache 2.0
|
61 |
+
- **Fine-tuned from model:** [DETR-R50](https://github.com/facebookresearch/detr)
|
62 |
+
|
63 |
+
### Model Sources
|
64 |
+
|
65 |
+
<!-- Provide the basic links for the model. -->
|
66 |
+
|
67 |
+
- **Repository:** [Imageomics/INTR](https://github.com/Imageomics/INTR)
|
68 |
+
- **Paper:** [A Simple Interpretable Transformer for Fine-Grained Image Classification and Analysis](https://doi.org/10.48550/arXiv.2311.04157)
|
69 |
+
- **Demo:** [Inference time single-image prediction and visualization notebook](https://github.com/Imageomics/INTR/blob/main/demo.ipynb). Note that this is focused on the CUB dataset.
|
70 |
+
|
71 |
+
<!-- I assume the demo could be adjusted to work with either of the other datasets by adjusting a few parameters? If so, please note, otherwise indicate that it is not so simple -->
|
72 |
+
|
73 |
+
## Uses
|
74 |
+
|
75 |
+
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
76 |
+
|
77 |
+
### Direct Use
|
78 |
+
|
79 |
+
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
80 |
+
|
81 |
+
[More Information Needed]
|
82 |
+
|
83 |
+
### Downstream Use [optional]
|
84 |
+
|
85 |
+
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
86 |
+
|
87 |
+
[More Information Needed]
|
88 |
+
|
89 |
+
### Out-of-Scope Use
|
90 |
+
|
91 |
+
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
92 |
+
|
93 |
+
[More Information Needed]
|
94 |
+
|
95 |
+
## Bias, Risks, and Limitations
|
96 |
+
|
97 |
+
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
98 |
+
|
99 |
+
[More Information Needed]
|
100 |
+
|
101 |
+
### Recommendations
|
102 |
+
|
103 |
+
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
104 |
+
|
105 |
+
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
106 |
+
|
107 |
+
## How to Get Started with the Model
|
108 |
+
|
109 |
+
Use the code below to get started with the model.
|
110 |
+
|
111 |
+
<!-- Put code here or links to files to run. Set up code blocks like this:
|
112 |
+
```
|
113 |
+
<code here>
|
114 |
+
```
|
115 |
+
-->
|
116 |
+
|
117 |
+
[More Information Needed]
|
118 |
+
|
119 |
+
## Training Details
|
120 |
+
|
121 |
+
### Training Data
|
122 |
+
|
123 |
+
<!-- This should link to a Data Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering.
|
124 |
+
In this case, at least add information and link specifically to the training sets for CUB & Kaggle Birds (assuming that's what was used).
|
125 |
+
Also, preprocessing on these images needs to be described (eg., resizing). -->
|
126 |
+
|
127 |
+
[More Information Needed]
|
128 |
+
|
129 |
+
| Model | Dataset |
|
130 |
+
|----------|----------|
|
131 |
+
| [CUB checkpoint download](https://huggingface.co/imageomics/INTR/resolve/main/intr_checkpoint_cub_detr_r50.pth)| [CUB](https://www.vision.caltech.edu/datasets/cub_200_2011/) [More Information Needed]<!-- What was the training data? --> |
|
132 |
+
| [Bird checkpoint download](https://huggingface.co/imageomics/INTR/resolve/main/intr_checkpoint_bird_detr_r50.pth) | [Birds 525](https://www.kaggle.com/datasets/gpiosenka/100-bird-species) [More Information Needed]<!-- What was the training data? --> |
|
133 |
+
| [Butterfly checkpoint download](https://huggingface.co/imageomics/INTR/resolve/main/intr_checkpoint_butterfly_detr_r50.pth) | [Cambridge Butterfly](https://huggingface.co/datasets/imageomics/Cambridge_butterfly), images in the `train` folder |
|
134 |
+
|
135 |
+
|
136 |
+
### Training Procedure
|
137 |
+
|
138 |
+
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
139 |
+
[More Information Needed]
|
140 |
+
|
141 |
+
Follow the below format for data.
|
142 |
+
```
|
143 |
+
datasets
|
144 |
+
βββ dataset_name
|
145 |
+
β βββ train
|
146 |
+
β β βββ class1
|
147 |
+
β β β βββ img1.jpeg
|
148 |
+
β β β βββ img2.jpeg
|
149 |
+
β β β βββ ...
|
150 |
+
β β βββ class2
|
151 |
+
β β β βββ img3.jpeg
|
152 |
+
β β β βββ ...
|
153 |
+
β β βββ ...
|
154 |
+
β βββ val
|
155 |
+
β βββ class1
|
156 |
+
β β βββ img4.jpeg
|
157 |
+
β β βββ img5.jpeg
|
158 |
+
β β βββ ...
|
159 |
+
β βββ class2
|
160 |
+
β β βββ img6.jpeg
|
161 |
+
β β βββ ...
|
162 |
+
β βββ ...
|
163 |
+
```
|
164 |
+
|
165 |
+
#### Preprocessing [optional]
|
166 |
+
|
167 |
+
[More Information Needed]
|
168 |
+
|
169 |
+
|
170 |
+
#### Training Hyperparameters
|
171 |
+
|
172 |
+
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
173 |
+
|
174 |
+
#### Speeds, Sizes, Times [optional]
|
175 |
+
|
176 |
+
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
177 |
+
|
178 |
+
[More Information Needed]
|
179 |
+
|
180 |
+
## Evaluation
|
181 |
+
|
182 |
+
<!-- This section describes the evaluation protocols and provides the results. -->
|
183 |
+
|
184 |
+
To evaluate the performance of INTR on the _CUB_ dataset, on a multi-GPU (e.g., 4 GPUs) settings, execute the below command. INTR checkpoints are available at Fine-tune model and results.
|
185 |
+
|
186 |
+
```sh
|
187 |
+
CUDA_VISIBLE_DEVICES=0,1,2,3 python -m torch.distributed.launch --nproc_per_node=4 --master_port 12345 --use_env main.py --eval --resume <path/to/intr_checkpoint_cub_detr_r50.pth> --dataset_path <path/to/datasets> --dataset_name <dataset_name>
|
188 |
+
```
|
189 |
+
|
190 |
+
Similarly, replace `cub` in the name of the checkpoint with `bird` or `butterfly` to evaluate with the Birds 525 or Cambridge Butterfly checkpoint, respectively.
|
191 |
+
|
192 |
+
### Testing Data, Factors & Metrics
|
193 |
+
|
194 |
+
#### Testing Data
|
195 |
+
|
196 |
+
<!-- This should link to a Data Card if possible.
|
197 |
+
In this case, at least add information and link specifically to the test sets for CUB & Kaggle Birds (assuming that's what was used) -->
|
198 |
+
|
199 |
+
[More Information Needed]
|
200 |
+
|
201 |
+
| Model | Dataset |
|
202 |
+
|----------|----------|
|
203 |
+
| [CUB checkpoint download](https://huggingface.co/imageomics/INTR/resolve/main/intr_checkpoint_cub_detr_r50.pth)| [CUB](https://www.vision.caltech.edu/datasets/cub_200_2011/) [More Information Needed]<!-- What was the test data? --> |
|
204 |
+
| [Birds checkpoint download](https://huggingface.co/imageomics/INTR/resolve/main/intr_checkpoint_bird_detr_r50.pth) | [Birds 525](https://www.kaggle.com/datasets/gpiosenka/100-bird-species) [More Information Needed]<!-- What was the test data? --> |
|
205 |
+
| [Butterfly checkpoint download](https://huggingface.co/imageomics/INTR/resolve/main/intr_checkpoint_butterfly_detr_r50.pth) | [Cambridge Butterfly](https://huggingface.co/datasets/imageomics/Cambridge_butterfly), images in the `val` folder |
|
206 |
+
|
207 |
+
|
208 |
+
#### Factors
|
209 |
+
|
210 |
+
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
211 |
+
|
212 |
+
[More Information Needed]
|
213 |
+
|
214 |
+
#### Metrics
|
215 |
+
|
216 |
+
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
217 |
+
|
218 |
+
[More Information Needed]
|
219 |
+
|
220 |
+
### Results
|
221 |
+
|
222 |
+
|
223 |
+
| Dataset | acc@1 | acc@5 |
|
224 |
+
|----------|----------|----------|
|
225 |
+
| [CUB](https://www.vision.caltech.edu/datasets/cub_200_2011/) | 71.8 | 89.3 |
|
226 |
+
| [Birds 525](https://www.kaggle.com/datasets/gpiosenka/100-bird-species) | 97.4 | 99.2 |
|
227 |
+
| [Butterfly](https://huggingface.co/datasets/imageomics/Cambridge_butterfly) | 95.0 | 98.3 |
|
228 |
+
|
229 |
+
|
230 |
+
#### Summary
|
231 |
+
|
232 |
+
[More Information Needed]
|
233 |
+
|
234 |
+
## Model Examination [optional]
|
235 |
+
|
236 |
+
<!-- Relevant interpretability work for the model goes here -->
|
237 |
+
|
238 |
+
[More Information Needed]
|
239 |
+
|
240 |
+
## Environmental Impact
|
241 |
+
|
242 |
+
<!--
|
243 |
+
It would be great to try to include this.
|
244 |
+
|
245 |
+
Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
246 |
+
|
247 |
+
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://doi.org/10.48550/arXiv.1910.09700).
|
248 |
+
|
249 |
+
- **Hardware Type:** [More Information Needed]
|
250 |
+
- **Hours used:** [More Information Needed]
|
251 |
+
- **Cloud Provider:** [More Information Needed]
|
252 |
+
- **Compute Region:** [More Information Needed]
|
253 |
+
- **Carbon Emitted:** [More Information Needed]
|
254 |
+
|
255 |
+
## Technical Specifications [optional]
|
256 |
+
|
257 |
+
### Model Architecture and Objective
|
258 |
+
|
259 |
+
[More Information Needed]
|
260 |
+
|
261 |
+
### Compute Infrastructure
|
262 |
+
|
263 |
+
[More Information Needed]
|
264 |
+
|
265 |
+
#### Hardware
|
266 |
+
|
267 |
+
[More Information Needed]
|
268 |
+
|
269 |
+
#### Software
|
270 |
+
|
271 |
+
[More Information Needed]
|
272 |
+
|
273 |
+
## Citation
|
274 |
+
|
275 |
+
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
276 |
+
|
277 |
+
**BibTeX:**
|
278 |
+
|
279 |
+
[![Paper](https://img.shields.io/badge/Paper-10.48550%2FarXiv.2311.04157-blue)](https://doi.org/10.48550/arXiv.2311.04157)
|
280 |
+
If you find our work helpful for your research, please consider citing our paper as well.
|
281 |
+
```
|
282 |
+
@article{paul2023simple,
|
283 |
+
title={A Simple Interpretable Transformer for Fine-Grained Image Classification and Analysis},
|
284 |
+
author={Paul, Dipanjyoti and Chowdhury, Arpita and Xiong, Xinqi and Chang, Feng-Ju and Carlyn, David and Stevens, Samuel and Provost, Kaiya and Karpatne, Anuj and Carstens, Bryan and Rubenstein, Daniel and Stewart, Charles and Berger-Wolf, Tanya and Su, Yu and Chao, Wei-Lun},
|
285 |
+
journal={arXiv preprint arXiv:2311.04157},
|
286 |
+
year={2023}
|
287 |
+
}
|
288 |
+
```
|
289 |
+
|
290 |
+
Model Citation:
|
291 |
+
```
|
292 |
+
@software{Paul_A_Simple_Interpretable_2023,
|
293 |
+
author = {Paul, Dipanjyoti and Chowdhury, Arpita and Xiong, Xinqi and Chang, Feng-Ju and Carlyn, David and Stevens, Samuel and Provost, Kaiya and Karpatne, Anuj and Carstens, Bryan and Rubenstein, Daniel and Stewart, Charles and Berger-Wolf, Tanya and Su, Yu and Chao, Wei-Lun},
|
294 |
+
license = {Apache-2.0},
|
295 |
+
title = {{A Simple Interpretable Transformer for Fine-Grained Image Classification and Analysis}},
|
296 |
+
doi = {<doi once generated>},
|
297 |
+
url = {https://huggingface.co/imageomics/INTR},
|
298 |
+
version = {1.0.0},
|
299 |
+
month = sep,
|
300 |
+
year = {2023}
|
301 |
+
}
|
302 |
+
|
303 |
+
```
|
304 |
+
|
305 |
+
|
306 |
+
**APA:** <!--optional-->
|
307 |
+
|
308 |
+
Paper:
|
309 |
+
|
310 |
+
Paul, D., Chowdhury, A., Xiong, X., Chang, F., Carlyn, D., Stevens, S., Provost, K., Karpatne, A., Carstens, B., Rubenstein, D., Stewart, C., Berger-Wolf, T., Su, Y., & Chao, W. (2023). A Simple Interpretable Transformer for Fine-Grained Image Classification and Analysis. arXiv. https://doi.org/10.48550/arXiv.2311.04157.
|
311 |
+
|
312 |
+
|
313 |
+
Model Citation:
|
314 |
+
|
315 |
+
Paul, D., Chowdhury, A., Xiong, X., Chang, F., Carlyn, D., Stevens, S., Provost, K., Karpatne, A., Carstens, B., Rubenstein, D., Stewart, C., Berger-Wolf, T., Su, Y., & Chao, W. (2023). A Simple Interpretable Transformer for Fine-Grained Image Classification and Analysis (Version 1.0.0). <!--Add DOI once generated -->
|
316 |
+
|
317 |
+
## Acknowledgements
|
318 |
+
|
319 |
+
Our model is inspired by the DEtection TRansformer [(DETR)](https://github.com/facebookresearch/detr) method.
|
320 |
+
|
321 |
+
We thank the authors of DETR for doing such great work.
|
322 |
+
|
323 |
+
The [Imageomics Institute](https://imageomics.org) is funded by the US National Science Foundation's Harnessing the Data Revolution (HDR) 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). Any opinions, findings and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.
|
324 |
+
|
325 |
+
## Glossary [optional]
|
326 |
+
|
327 |
+
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
328 |
+
|
329 |
+
[More Information Needed]
|
330 |
+
|
331 |
+
## More Information [optional]
|
332 |
+
|
333 |
+
[More Information Needed]
|
334 |
+
|
335 |
+
## Model Card Authors [optional]
|
336 |
+
|
337 |
+
[More Information Needed]
|
338 |
+
|
339 |
+
## Model Card Contact
|
340 |
|
341 |
+
[More Information Needed]
|