restore README and add usage
Browse files
README.md
CHANGED
@@ -76,10 +76,6 @@ Data generated by Elizabeth Postema using DrawerDissect on Field Museum specimen
|
|
76 |
|
77 |
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
78 |
|
79 |
-
#### Preprocessing [optional]
|
80 |
-
|
81 |
-
[More Information Needed]
|
82 |
-
|
83 |
|
84 |
#### Training Hyperparameters
|
85 |
|
@@ -119,12 +115,52 @@ Subspecies:
|
|
119 |
- Specimen-weighted precision: 85.0%
|
120 |
- Specimen-weighted recall: 89.0%
|
121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
|
123 |
|
124 |
## Citation
|
125 |
|
126 |
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
127 |
|
|
|
|
|
128 |
**BibTeX:**
|
129 |
|
130 |
[More Information Needed]
|
@@ -136,4 +172,4 @@ Subspecies:
|
|
136 |
|
137 |
## Model Card Authors
|
138 |
|
139 |
-
Bruno de Medeiros, Negaunee Assistant Curator of Pollinating Insects, Field Museum
|
|
|
76 |
|
77 |
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
78 |
|
|
|
|
|
|
|
|
|
79 |
|
80 |
#### Training Hyperparameters
|
81 |
|
|
|
115 |
- Specimen-weighted precision: 85.0%
|
116 |
- Specimen-weighted recall: 89.0%
|
117 |
|
118 |
+
## Usage
|
119 |
+
|
120 |
+
The learner can be loaded to fastai with:
|
121 |
+
|
122 |
+
```{python}
|
123 |
+
from huggingface_hub import from_pretrained_fastai
|
124 |
+
learn = from_pretrained_fastai("brunoasm/eva02_large_patch14_448.Cicindela_ID_FMNH")
|
125 |
+
```
|
126 |
+
|
127 |
+
To avoid loading a pickle file and loading the model weights only, you can use:
|
128 |
+
```{python}
|
129 |
+
import requests
|
130 |
+
import io
|
131 |
+
from fastai.vision.all import *
|
132 |
+
|
133 |
+
def load_model_from_url(learn, url):
|
134 |
+
try:
|
135 |
+
print("Downloading model...")
|
136 |
+
response = requests.get(url, stream=True)
|
137 |
+
response.raise_for_status()
|
138 |
+
|
139 |
+
buffer = io.BytesIO(response.content)
|
140 |
+
learn.load(buffer, with_opt=False)
|
141 |
+
print("Model loaded successfully!")
|
142 |
+
|
143 |
+
except Exception as e:
|
144 |
+
print(f"Error loading model: {e}")
|
145 |
+
|
146 |
+
url = 'https://huggingface.co/brunoasm/eva02_large_patch14_448.Cicindela_ID_FMNH/resolve/main/pytorch_model.bin'
|
147 |
+
learn = vision_learner(dls, "eva02_large_patch14_448.mim_m38m_ft_in22k_in1k")
|
148 |
+
|
149 |
+
response = requests.get(url, stream=True)
|
150 |
+
response.raise_for_status()
|
151 |
+
buffer = io.BytesIO(response.content)
|
152 |
+
learn.load(buffer, with_opt=False)
|
153 |
+
|
154 |
+
```
|
155 |
+
where `dls` is a previously created dataloader.
|
156 |
|
157 |
|
158 |
## Citation
|
159 |
|
160 |
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
161 |
|
162 |
+
Postema, E. G., Briscoe, L., Harder, C., Hancock, G. R. A., Guarnieri, L. D., Eisel, T., Welch, K., de Souza, D., Phillip, D., Baquiran, R., Sepulveda, T., Ree, R., & de Medeiros, B. A. S. (in preparation). DrawerDissect: Whole-drawer insect imaging, segmentation, and transcription using AI.
|
163 |
+
|
164 |
**BibTeX:**
|
165 |
|
166 |
[More Information Needed]
|
|
|
172 |
|
173 |
## Model Card Authors
|
174 |
|
175 |
+
Bruno de Medeiros, Negaunee Assistant Curator of Pollinating Insects, Field Museum
|