Skip to content

Commit c2c8be1

Browse files
committed
feat: add latest regional models
Closes RolnickLab/antenna#414
1 parent 9ff9a5c commit c2c8be1

File tree

4 files changed

+107
-10
lines changed

4 files changed

+107
-10
lines changed

trapdata/api/api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
MothClassifierBinary,
1616
MothClassifierGlobal,
1717
MothClassifierPanama,
18+
MothClassifierPanama2024,
1819
MothClassifierQuebecVermont,
1920
MothClassifierTuringCostaRica,
2021
MothClassifierUKDenmark,
@@ -43,6 +44,7 @@ class SourceImageResponse(pydantic.BaseModel):
4344

4445
PIPELINE_CHOICES = {
4546
"panama_moths_2023": MothClassifierPanama,
47+
"panama_moths_2024": MothClassifierPanama2024,
4648
"quebec_vermont_moths_2023": MothClassifierQuebecVermont,
4749
"uk_denmark_moths_2023": MothClassifierUKDenmark,
4850
"costa_rica_moths_turing_2024": MothClassifierTuringCostaRica,

trapdata/api/demo.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
MothClassifierBinary,
1111
MothClassifierGlobal,
1212
MothClassifierPanama,
13+
MothClassifierPanama2024,
1314
MothClassifierQuebecVermont,
1415
MothClassifierTuringCostaRica,
1516
MothClassifierUKDenmark,
@@ -131,13 +132,15 @@ def make_interface(Classifier: MothClassifier, example_images_subdir=""):
131132
app = gr.TabbedInterface(
132133
[
133134
make_interface(MothClassifierPanama, "panama"), # type: ignore
135+
make_interface(MothClassifierPanama2024, "panama"), # type: ignore
134136
make_interface(MothClassifierUKDenmark, "denmark"), # type: ignore
135137
make_interface(MothClassifierQuebecVermont, "vermont"), # type: ignore
136138
make_interface(MothClassifierTuringCostaRica, "costarica"), # type: ignore
137-
make_interface(MothClassifierGlobal, "global"), # type: ignore
139+
make_interface(MothClassifierGlobal, "vermont"), # type: ignore
138140
],
139141
[
140-
"Panama",
142+
"Panama 2023",
143+
"Panama 2024",
141144
"UK/Denmark",
142145
"Quebec/Vermont",
143146
"Costa Rica",

trapdata/api/models/classification.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@
1010
GlobalMothSpeciesClassifier,
1111
InferenceBaseClass,
1212
MothNonMothClassifier,
13+
PanamaMothSpeciesClassifier2024,
1314
PanamaMothSpeciesClassifierMixedResolution2023,
14-
QuebecVermontMothSpeciesClassifierMixedResolution,
15+
QuebecVermontMothSpeciesClassifier2024,
1516
TuringCostaRicaSpeciesClassifier,
16-
UKDenmarkMothSpeciesClassifierMixedResolution,
17+
UKDenmarkMothSpeciesClassifier2024,
1718
)
1819

1920
from ..datasets import ClassificationImageDataset
@@ -145,14 +146,20 @@ class MothClassifierPanama(
145146
pass
146147

147148

149+
class MothClassifierPanama2024(
150+
MothClassifier, PanamaMothSpeciesClassifier2024
151+
):
152+
pass
153+
154+
148155
class MothClassifierUKDenmark(
149-
MothClassifier, UKDenmarkMothSpeciesClassifierMixedResolution
156+
MothClassifier, UKDenmarkMothSpeciesClassifier2024
150157
):
151158
pass
152159

153160

154161
class MothClassifierQuebecVermont(
155-
MothClassifier, QuebecVermontMothSpeciesClassifierMixedResolution
162+
MothClassifier, QuebecVermontMothSpeciesClassifier2024
156163
):
157164
pass
158165

trapdata/ml/models/classification.py

Lines changed: 89 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,22 @@ class TuringUKSpeciesClassifier(SpeciesClassifier, Resnet50Classifier_Turing):
359359
"03_uk_data_category_map.json"
360360
)
361361

362+
class QuebecVermontMothSpeciesClassifierMixedResolution(
363+
SpeciesClassifier, Resnet50ClassifierLowRes
364+
):
365+
name = "Quebec & Vermont Species Classifier"
366+
description = (
367+
"Trained on February 24, 2022 using mix of low & med resolution images"
368+
)
369+
weights_path = (
370+
"https://object-arbutus.cloud.computecanada.ca/ami-models/moths/classification/"
371+
"moths_quebecvermont_resnet50_randaug_mixres_128_fev24.pth"
372+
)
373+
labels_path = (
374+
"https://object-arbutus.cloud.computecanada.ca/ami-models/moths/classification/"
375+
"quebec-vermont_moth-category-map_19Jan2023.json"
376+
)
377+
362378

363379
class UKDenmarkMothSpeciesClassifierMixedResolution(
364380
SpeciesClassifier, Resnet50ClassifierLowRes
@@ -382,7 +398,6 @@ class UKDenmarkMothSpeciesClassifierMixedResolution(
382398
"01-moths-ukdenmark_v2_category_map_species_names.json"
383399
)
384400

385-
386401
class PanamaMothSpeciesClassifierMixedResolution(SpeciesClassifier, Resnet50Classifier):
387402
name = "Panama Species Classifier"
388403
description = "Trained on December 22, 2022 using a mix of low & med resolution images. 148 species."
@@ -415,13 +430,13 @@ class PanamaMothSpeciesClassifierMixedResolution2023(
415430

416431

417432
class GlobalMothSpeciesClassifier(SpeciesClassifier, Resnet50TimmClassifier):
418-
name = "Global Species Classifier 2024"
419433
input_size = 128
420-
lookup_gbif_names = False
421434
normalization = imagenet_normalization
435+
lookup_gbif_names = False
422436

437+
name = "Global Species Classifier - Aug 2024"
423438
description = (
424-
"Trained on August 28th, 2024 on 29,176 species. "
439+
"Trained on August 28th, 2024 for 29,176 species. "
425440
"https://wandb.ai/moth-ai/global-moth-classifier/runs/h0cuqrbc/overview"
426441
)
427442
weights_path = (
@@ -432,3 +447,73 @@ class GlobalMothSpeciesClassifier(SpeciesClassifier, Resnet50TimmClassifier):
432447
"https://object-arbutus.cloud.computecanada.ca/ami-models/moths/classification/"
433448
"global_category_map_with_names_20240828.json"
434449
)
450+
451+
452+
class QuebecVermontMothSpeciesClassifier2024(
453+
SpeciesClassifier, Resnet50TimmClassifier
454+
):
455+
input_size = 128
456+
normalization = imagenet_normalization
457+
lookup_gbif_names = False
458+
459+
name = "Quebec & Vermont Species Classifier - Apr 2024"
460+
description = (
461+
"Trained on April 17, 2024 for 2,497 species. "
462+
"https://wandb.ai/moth-ai/ami-gbif-fine-grained/runs/1x53zmp2/overview"
463+
)
464+
weights_path = (
465+
"https://object-arbutus.cloud.computecanada.ca/ami-models/moths/classification/"
466+
"quebec-vermont_resnet50_baseline_20240417_950de764.pth"
467+
)
468+
labels_path = (
469+
"https://object-arbutus.cloud.computecanada.ca/ami-models/moths/classification/"
470+
"01_ami-gbif_fine-grained_ne-america_category_map-with_names.json"
471+
)
472+
473+
474+
475+
class UKDenmarkMothSpeciesClassifier2024(
476+
SpeciesClassifier, Resnet50TimmClassifier
477+
):
478+
input_size = 128
479+
normalization = imagenet_normalization
480+
lookup_gbif_names = False
481+
482+
name = "UK & Denmark Species Classifier - Apr 2024"
483+
description = (
484+
"Trained on April 17, 2024 for 2,603 species. "
485+
"https://wandb.ai/moth-ai/ami-gbif-fine-grained/runs/x5u7jcbf/overview"
486+
)
487+
weights_path = (
488+
"https://object-arbutus.cloud.computecanada.ca/ami-models/moths/classification/"
489+
"uk-denmark_resnet50_baseline_20240417_55250a8b.pth"
490+
)
491+
labels_path = (
492+
"https://object-arbutus.cloud.computecanada.ca/ami-models/moths/classification/"
493+
"02_ami-gbif_fine-grained_w-europe_category_map-with_names.json"
494+
)
495+
496+
497+
class PanamaMothSpeciesClassifier2024(
498+
SpeciesClassifier, Resnet50TimmClassifier
499+
):
500+
input_size = 128
501+
normalization = imagenet_normalization
502+
lookup_gbif_names = False
503+
504+
name = "Panama Species Classifier - Apr 2024"
505+
description = (
506+
"Trained on April 17, 2024 for 636 species. "
507+
"https://wandb.ai/moth-ai/ami-gbif-fine-grained/runs/1sekgkan/overview"
508+
)
509+
510+
weights_path = (
511+
"https://object-arbutus.cloud.computecanada.ca/ami-models/moths/classification/"
512+
"panama_resnet50_baseline_20240417_edbb46dd.pth"
513+
)
514+
labels_path = (
515+
"https://object-arbutus.cloud.computecanada.ca/ami-models/moths/classification/"
516+
"03_ami-gbif_fine-grained_c-america_category_map-with_names.json"
517+
)
518+
519+

0 commit comments

Comments
 (0)