File size: 52,352 Bytes
e19db67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""
LILA Camera Traps is an aggregate data set of images taken by camera traps, which are devices that automatically (e.g. via motion detection) capture images of wild animals to help ecological research.

This data set is the first time when disparate camera trap data sets have been aggregated into a single training environment with a single taxonomy.

This data set consists of only camera trap image data sets, whereas the broader LILA website (https://lila.science) also has other data sets related to biology and conservation, intended as a resource for both machine learning (ML) researchers and those that want to harness ML for this topic.
"""

import json
import os
import pandas as pd

import datasets

_LILA_CITATIONS = {
    "Caltech Camera Traps": """
    @inproceedings{DBLP:conf/eccv/BeeryHP18,
      author    = {Sara Beery and
                   Grant Van Horn and
                   Pietro Perona},
      title     = {Recognition in Terra Incognita},
      booktitle = {Computer Vision - {ECCV} 2018 - 15th European Conference, Munich,
                   Germany, September 8-14, 2018, Proceedings, Part {XVI}},
      pages     = {472--489},
      year      = {2018},
      crossref  = {DBLP:conf/eccv/2018-16},
      url       = {https://doi.org/10.1007/978-3-030-01270-0\_28},
      doi       = {10.1007/978-3-030-01270-0\_28},
      timestamp = {Mon, 08 Oct 2018 17:08:07 +0200},
      biburl    = {https://dblp.org/rec/bib/conf/eccv/BeeryHP18},
      bibsource = {dblp computer science bibliography, https://dblp.org}
    }    
    """,
    "ENA24": """
    @article{yousif2019dynamic,
    title={Dynamic Programming Selection of Object Proposals for Sequence-Level Animal Species Classification in the Wild},
    author={Yousif, Hayder and Kays, Roland and He, Zhihai},
    journal={IEEE Transactions on Circuits and Systems for Video Technology},
    year={2019},
    publisher={IEEE}
    }
    """,
    "Missouri Camera Traps": """
    @article{zhang2016animal,
      title={Animal detection from highly cluttered natural scenes using spatiotemporal object region proposals and patch verification},
      author={Zhang, Zhi and He, Zhihai and Cao, Guitao and Cao, Wenming},
      journal={IEEE Transactions on Multimedia},
      volume={18},
      number={10},
      pages={2079--2092},
      year={2016},
      publisher={IEEE}
    }    
    """,
    "NACTI": """
    @article{tabak2019machine,
      title={Machine learning to classify animal species in camera trap images: Applications in ecology},
      author={Tabak, Michael A and Norouzzadeh, Mohammad S and Wolfson, David W and Sweeney, Steven J and VerCauteren, Kurt C and Snow, Nathan P and Halseth, Joseph M and Di Salvo, Paul A and Lewis, Jesse S and White, Michael D and others},
      journal={Methods in Ecology and Evolution},
      volume={10},
      number={4},
      pages={585--590},
      year={2019},
      publisher={Wiley Online Library}
    }    
    """,
    "WCS Camera Traps": "",
    "Wellington Camera Traps": """
    @article{anton2018monitoring,
      title={Monitoring the mammalian fauna of urban areas using remote cameras and citizen science},
      author={Anton, Victor and Hartley, Stephen and Geldenhuis, Andre and Wittmer, Heiko U},
      journal={Journal of Urban Ecology},
      volume={4},
      number={1},
      pages={juy002},
      year={2018},
      publisher={Oxford University Press}
    }    
    """,
    "Island Conservation Camera Traps": "",
    "Channel Islands Camera Traps": "",
    "Idaho Camera Traps": "",
    "Snapshot Serengeti": """
    @misc{dryad_5pt92,
        title = {Data from: Snapshot Serengeti, high-frequency annotated camera trap images of 40 mammalian species in an African savanna},
        author = {Swanson, AB and Kosmala, M and Lintott, CJ and Simpson, RJ and Smith, A and Packer, C},
        year = {2015},
        journal = {Scientific Data},
        URL = {https://doi.org/10.5061/dryad.5pt92},
        doi = {doi:10.5061/dryad.5pt92},
        publisher = {Dryad Digital Repository}
    }    
    """,
    "Snapshot Karoo": "",
    "Snapshot Kgalagadi": "",
    "Snapshot Enonkishu": "",
    "Snapshot Camdeboo": "",
    "Snapshot Mountain Zebra": "",
    "Snapshot Kruger": "",
    "SWG Camera Traps": "",
    "Orinoquia Camera Traps": """
    @article{velez2022choosing,
      title={Choosing an Appropriate Platform and Workflow for Processing Camera Trap Data using Artificial Intelligence},
      author={V{\'e}lez, Juliana and Castiblanco-Camacho, Paula J and Tabak, Michael A and Chalmers, Carl and Fergus, Paul and Fieberg, John},
      journal={arXiv preprint arXiv:2202.02283},
      year={2022}
    }    
    """,
}

# You can copy an official description
_DESCRIPTION = """\
LILA Camera Traps is an aggregate data set of images taken by camera traps, which are devices that automatically (e.g. via motion detection) capture images of wild animals to help ecological research.

This data set is the first time when disparate camera trap data sets have been aggregated into a single training environment with a single taxonomy.

This data set consists of only camera trap image data sets, whereas the broader LILA website also has other data sets related to biology and conservation, intended as a resource for both machine learning (ML) researchers and those that want to harness ML for this topic.
"""

_HOMEPAGE = "https://huggingface.co/datasets/society-ethics/LILA"

_LILA_SAS_URLS = pd.read_csv("https://lila.science/wp-content/uploads/2020/03/lila_sas_urls.txt")
_LILA_SAS_URLS.rename(columns={"# name": "name"}, inplace=True)

_METADATA_BASE_URL = "https://huggingface.co/datasets/NimaBoscarino/LILA/resolve/main/data/"

_LILA_URLS = {
    "Caltech Camera Traps": "Caltech_Camera_Traps.jsonl.zip",
    "ENA24": "ENA24.jsonl.zip",
    "Missouri Camera Traps": "Missouri_Camera_Traps.jsonl.zip",
    "NACTI": "NACTI.jsonl.zip",
    "WCS Camera Traps": "WCS_Camera_Traps.jsonl.zip",
    "Wellington Camera Traps": "Wellington_Camera_Traps.jsonl.zip",
    "Island Conservation Camera Traps": "Island_Conservation_Camera_Traps.jsonl.zip",
    "Channel Islands Camera Traps": "Channel_Islands_Camera_Traps.jsonl.zip",
    "Idaho Camera Traps": "Idaho_Camera_Traps.jsonl.zip",
    "Snapshot Serengeti": "Snapshot_Serengeti.jsonl.zip",
    "Snapshot Karoo": "Snapshot_Karoo.jsonl.zip",
    "Snapshot Kgalagadi": "Snapshot_Kgalagadi.jsonl.zip",
    "Snapshot Enonkishu": "Snapshot_Enonkishu.jsonl.zip",
    "Snapshot Camdeboo": "Snapshot_Camdeboo.jsonl.zip",
    "Snapshot Mountain Zebra": "Snapshot_Mountain_Zebra.jsonl.zip",
    "Snapshot Kruger": "Snapshot_Kruger.jsonl.zip",
    "SWG Camera Traps": "SWG_Camera_Traps.jsonl.zip",
    "Orinoquia Camera Traps": "Orinoquia_Camera_Traps.jsonl.zip",
}

_TAXONOMY = {
    "kingdom": datasets.ClassLabel(num_classes=1, names=["animalia"]),
    "phylum": datasets.ClassLabel(num_classes=2, names=["chordata", "arthropoda"]),
    "subphylum": datasets.ClassLabel(num_classes=5, names=[
        'vertebrata', 'hexapoda', 'crustacea', 'chelicerata',
        'myriapoda'
    ]),
    "superclass": datasets.ClassLabel(num_classes=1, names=["multicrustacea"]),
    "class": datasets.ClassLabel(num_classes=8, names=[
        'mammalia', 'aves', 'insecta', 'reptilia', 'malacostraca',
        'arachnida', 'diplopoda', 'amphibia'
    ]),
    "subclass": datasets.ClassLabel(num_classes=3, names=[
        'theria', 'pterygota', 'eumalacostraca'
    ]),
    "infraclass": datasets.ClassLabel(num_classes=2, names=[
        'placentalia', 'marsupialia'
    ]),
    "superorder": datasets.ClassLabel(num_classes=5, names=[
        'laurasiatheria', 'euarchontoglires', 'eucarida', 'xenarthra',
        'afrotheria'
    ]),
    "order": datasets.ClassLabel(num_classes=53, names=[
        'carnivora', 'chiroptera', 'artiodactyla', 'squamata',
        'didelphimorphia', 'lagomorpha', 'rodentia', 'primates',
        'passeriformes', 'galliformes', 'perissodactyla',
        'accipitriformes', 'caprimulgiformes', 'lepidoptera',
        'strigiformes', 'piciformes', 'falconiformes', 'charadriiformes',
        'decapoda', 'columbiformes', 'pelecaniformes', 'procellariiformes',
        'gruiformes', 'testudines', 'araneae', 'tinamiformes', 'cingulata',
        'coraciiformes', 'hymenoptera', 'pilosa', 'cathartiformes',
        'tubulidentata', 'otidiformes', 'struthioniformes', 'proboscidea',
        'crocodylia', 'pholidota', 'scandentia', 'trogoniformes',
        'bucerotiformes', 'anseriformes', 'eulipotyphla', 'psittaciformes',
        'cuculiformes', 'ciconiiformes', 'musophagiformes', 'hyracoidea',
        'eurypygiformes', 'afrosoricida', 'galbuliformes', 'macroscelidea',
        'anura', 'rheiformes'
    ]),
    "suborder": datasets.ClassLabel(num_classes=17, names=[
        'ruminantia', 'suina', 'sciuromorpha', 'haplorhini',
        'hystricomorpha', 'pleocyemata', 'sauria', 'myomorpha',
        'castorimorpha', 'apocrita', 'vermilingua', 'anomaluromorpha',
        'whippomorpha', 'serpentes', 'tylopoda', 'strepsirrhini',
        'tenrecomorpha'
    ]),
    "infraorder": datasets.ClassLabel(num_classes=9, names=[
        'simiiformes', 'hystricognathi', 'brachyura', 'anomura',
        'aculeata', 'ancodonta', 'chiromyiformes', 'lemuriformes',
        'lorisiformes'
    ]),
    "superfamily": datasets.ClassLabel(num_classes=12, names=[
        'hominoidea', 'erethizontoidea', 'paguroidea', 'muroidea',
        'chelonioidea', 'cavioidea', 'formicoidea', 'octodontoidea',
        'lemuroidea', 'chinchilloidea', 'cheirogaleoidea', 'papilionoidea'
    ]),
    "family": datasets.ClassLabel(num_classes=159, names=[
        'mustelidae', 'felidae', 'bovidae', 'canidae', 'cervidae',
        'didelphidae', 'suidae', 'leporidae', 'procyonidae', 'mephitidae',
        'sciuridae', 'hominidae', 'ursidae', 'corvidae', 'phasianidae',
        'equidae', 'turdidae', 'accipitridae', 'trochilidae',
        'erethizontidae', 'antilocapridae', 'sittidae', 'parulidae',
        'cardinalidae', 'picidae', 'falconidae', 'strigidae', 'laridae',
        'columbidae', 'ardeidae', 'calcinidae', 'iguanidae',
        'megapodiidae', 'mimidae', 'varanidae', 'procellariidae',
        'rallidae', 'muridae', 'phocidae', 'hydrobatidae', 'dasyproctidae',
        'tayassuidae', 'tinamidae', 'cuniculidae', 'odontophoridae',
        'dasypodidae', 'passerellidae', 'troglodytidae', 'cricetidae',
        'geomyidae', 'momotidae', 'formicidae', 'caviidae', 'cracidae',
        'myrmecophagidae', 'chlamyphoridae', 'tapiridae', 'cebidae',
        'pitheciidae', 'cathartidae', 'atelidae', 'caprimulgidae',
        'orycteropodidae', 'hyaenidae', 'cercopithecidae', 'otididae',
        'gruidae', 'viverridae', 'pedetidae', 'herpestidae',
        'struthionidae', 'hystricidae', 'sagittariidae', 'testudinidae',
        'elephantidae', 'giraffidae', 'hippopotamidae', 'rhinocerotidae',
        'crocodylidae', 'numididae', 'manidae', 'irenidae', 'echimyidae',
        'pittidae', 'leiothrichidae', 'muscicapidae', 'tragulidae',
        'scolopacidae', 'hylobatidae', 'timaliidae', 'stenostiridae',
        'tupaiidae', 'trogonidae', 'bucerotidae', 'prionodontidae',
        'acrocephalidae', 'pycnonotidae', 'anatidae', 'anhimidae',
        'anomaluridae', 'aramidae', 'erinaceidae', 'brachypteraciidae',
        'threskiornithidae', 'psittacidae', 'buphagidae', 'burhinidae',
        'camelidae', 'sarothruridae', 'cuculidae', 'ciconiidae',
        'furnariidae', 'cisticolidae', 'apodidae', 'musophagidae',
        'nesomyidae', 'eupleridae', 'daubentoniidae', 'procaviidae',
        'dicaeidae', 'dicruridae', 'lemuridae', 'laniidae', 'vangidae',
        'eurypygidae', 'formicariidae', 'galagidae', 'grallariidae',
        'charadriidae', 'tenrecidae', 'scotocercidae', 'chinchillidae',
        'sturnidae', 'malaconotidae', 'macrosphenidae', 'cheirogaleidae',
        'alaudidae', 'icteridae', 'bucconidae', 'motacillidae',
        'nandiniidae', 'nectariniidae', 'estrildidae', 'bernieridae',
        'alligatoridae', 'macroscelididae', 'ploceidae', 'indriidae',
        'psophiidae', 'ramphastidae', 'ranidae', 'rheidae', 'spalacidae',
        'scincidae', 'soricidae', 'monarchidae', 'thryonomyidae',
        'teiidae', 'tytonidae'
    ]),
    "subfamily": datasets.ClassLabel(num_classes=69, names=[
        'taxidiinae', 'felinae', 'bovinae', 'capreolinae',
        'didelphinae', 'suinae', 'sciurinae', 'homininae', 'ursinae',
        'xerinae', 'mephitinae', 'antilopinae', 'cervinae', 'mustelinae',
        'guloninae', 'erethizontinae', 'sterninae', 'ardeinae', 'murinae',
        'lutrinae', 'melinae', 'neotominae', 'hydrochoerinae',
        'tigriornithinae', 'tolypeutinae', 'pantherinae', 'cebinae',
        'callicebinae', 'alouattinae', 'saimiriinae', 'protelinae',
        'cercopithecinae', 'genettinae', 'mungotinae', 'herpestinae',
        'ictonychinae', 'hyaeninae', 'mellivorinae', 'echimyinae',
        'paradoxurinae', 'ratufinae', 'helictidinae', 'colobinae',
        'viverrinae', 'hemigalinae', 'callosciurinae', 'erinaceinae',
        'atelinae', 'camelinae', 'caviinae', 'furnariinae', 'criniferinae',
        'cricetomyinae', 'euplerinae', 'deomyinae', 'nesomyinae',
        'euphractinae', 'galidiinae', 'tenrecinae', 'oryzorictinae',
        'musophaginae', 'myadinae', 'macroscelidinae', 'rhizomyinae',
        'rhynchocyoninae', 'scincinae', 'crocidurinae', 'tremarctinae',
        'tupinambinae'
    ]),
    "tribe": datasets.ClassLabel(num_classes=46, names=[
        'bovini', 'odocoileini', 'didelphini', 'suini', 'sciurini',
        'tamiini', 'marmotini', 'caprini', 'cervini', 'alceini', 'rattini',
        'capreolini', 'apodemini', 'reithrodontomyini', 'neotomini',
        'papionini', 'alcelaphini', 'potamochoerini', 'cephalophini',
        'tragelaphini', 'hippotragini', 'oreotragini', 'cercopithecini',
        'reduncini', 'antilopini', 'aepycerotini', 'phacochoerini',
        'xerini', 'echimyini', 'pteromyini', 'presbytini', 'muntiacini',
        'callosciurini', 'camelini', 'colobini', 'praomyini',
        'protoxerini', 'arvicanthini', 'malacomyini', 'metachirini',
        'murini', 'neotragini', 'macroscelidini', 'myocastorini',
        'rhizomyini', 'lamini'
    ]),
    "genus": datasets.ClassLabel(num_classes=476, names=[
        'taxidea', 'lynx', 'felis', 'bos', 'canis', 'odocoileus',
        'urocyon', 'puma', 'didelphis', 'sus', 'procyon', 'sciurus',
        'homo', 'ursus', 'corvus', 'gallus', 'tamias', 'sylvilagus',
        'equus', 'vulpes', 'mephitis', 'meleagris', 'marmota', 'ovis',
        'sialia', 'nucifraga', 'cervus', 'mustela', 'pekania', 'neogale',
        'pica', 'alces', 'erethizon', 'antilocapra', 'sitta', 'ixoreus',
        'piranga', 'falco', 'strix', 'anous', 'athene', 'nasua', 'capra',
        'ardea', 'butorides', 'calcinus', 'iguana', 'caloenas', 'rattus',
        'calonectris', 'asio', 'hydrobates', 'zenaida', 'nyctanassa',
        'turdus', 'dasyprocta', 'pecari', 'lepus', 'tinamus', 'leopardus',
        'cuniculus', 'mazama', 'tamiasciurus', 'capreolus', 'apodemus',
        'callipepla', 'cyanocitta', 'dasypus', 'dendragapus', 'junco',
        'lontra', 'martes', 'meles', 'otospermophilus', 'perisoreus',
        'troglodytes', 'peromyscus', 'neotoma', 'momotus', 'speothos',
        'hydrochoerus', 'cerdocyon', 'mitu', 'tigrisoma', 'myrmecophaga',
        'priodontes', 'pteronura', 'panthera', 'herpailurus', 'tapirus',
        'sapajus', 'plecturocebus', 'tamandua', 'penelope', 'eira',
        'cathartes', 'alouatta', 'saimiri', 'tayassu', 'orycteropus',
        'proteles', 'papio', 'damaliscus', 'syncerus', 'potamochoerus',
        'ardeotis', 'caracal', 'anthropoides', 'sylvicapra', 'tragelaphus',
        'dama', 'otocyon', 'oryx', 'genetta', 'pedetes', 'alcelaphus',
        'lupulella', 'oreotragus', 'suricata', 'herpestes', 'cynictis',
        'chlorocebus', 'struthio', 'hystrix', 'redunca', 'pelea',
        'sagittarius', 'antidorcas', 'raphicerus', 'connochaetes',
        'ictonyx', 'acinonyx', 'madoqua', 'cephalophus', 'loxodonta',
        'nanger', 'eudorcas', 'giraffa', 'hippopotamus', 'crocuta',
        'aepyceros', 'ourebia', 'phacochoerus', 'kobus', 'neotis',
        'parahyaena', 'bunolagus', 'diceros', 'mellivora', 'crocodylus',
        'pronolagus', 'hippotragus', 'leptailurus', 'lycaon', 'xerus',
        'ceratotherium', 'hyaena', 'nesolagus', 'irena', 'atherurus',
        'macaca', 'dactylomys', 'hydrornis', 'macropygia', 'varanus',
        'arctictis', 'ratufa', 'pterorhinus', 'cinclidium', 'myophonus',
        'moschiola', 'capricornis', 'cissa', 'paradoxurus', 'urva',
        'rheinardia', 'spilornis', 'chalcophaps', 'scolopax', 'melogale',
        'enicurus', 'trachypithecus', 'petaurista', 'cyanoderma',
        'catopuma', 'garrulax', 'culicicapa', 'polyplectron', 'arctonyx',
        'muntiacus', 'viverra', 'erythrogenys', 'prionailurus', 'picus',
        'pardofelis', 'paguma', 'nisaetus', 'ducula', 'tupaia',
        'harpactes', 'geokichla', 'chrotogale', 'callosciurus', 'manis',
        'dremomys', 'pygathrix', 'trochalopteron', 'ianthocincla',
        'aceros', 'rusa', 'zoothera', 'leiothrix', 'lophura', 'prionodon',
        'helarctos', 'pitta', 'tamiops', 'myiomela', 'urocissa',
        'accipiter', 'acrocephalus', 'acryllium', 'agamia', 'alectoris',
        'chamaetylas', 'alophoixus', 'alopochen', 'stelgidillas',
        'eurillas', 'anhima', 'anomalurus', 'aonyx', 'aquila', 'aramides',
        'aramus', 'arborophila', 'arctogalidia', 'ardeola', 'argusianus',
        'arremonops', 'atelerix', 'ateles', 'atelocynus', 'atelornis',
        'atilax', 'balearica', 'bambusicola', 'baryphthengus', 'bdeogale',
        'blastocerus', 'bostrychia', 'brachypteracias', 'brotogeris',
        'bubo', 'bubulcus', 'buphagus', 'burhinus', 'butastur', 'buteo',
        'buteogallus', 'bycanistes', 'cabassous', 'cairina', 'caloperdix',
        'camelus', 'mentocrex', 'caprimulgus', 'caracara', 'carpococcyx',
        'hylocichla', 'catharus', 'cavia', 'cebus', 'cercocebus',
        'cercopithecus', 'allochrocebus', 'cercotrichas', 'ortalis',
        'chelonoidis', 'ciconia', 'cinclodes', 'circus', 'cisticola',
        'civettictis', 'claravis', 'cochlearius', 'coendou', 'collocalia',
        'colobus', 'colomys', 'columba', 'columbina', 'conepatus',
        'copsychus', 'coragyps', 'corythaixoides', 'cossypha', 'coturnix',
        'coua', 'crax', 'cricetomys', 'cryptoprocta', 'crypturellus',
        'cuon', 'cyanoptila', 'cyornis', 'daptrius', 'daubentonia',
        'dendrocitta', 'dendrohyrax', 'ortygornis', 'deomys', 'dicaeum',
        'dicerorhinus', 'dicrurus', 'melaenornis', 'egretta', 'elephas',
        'eliurus', 'larvivora', 'erythrocebus', 'eulemur', 'euphractus',
        'eupleres', 'eupodotis', 'eurocephalus', 'euryceros', 'eurypyga',
        'eutriorchis', 'ficedula', 'formicarius', 'fossa', 'scleroptila',
        'pternistis', 'francolinus', 'funisciurus', 'galago', 'galictis',
        'galidia', 'galidictis', 'geotrygon', 'grallaria', 'guttera',
        'haliaeetus', 'vanellus', 'harpia', 'heliosciurus', 'helogale',
        'hemicentetes', 'hemigalus', 'urosphena', 'heterohyrax',
        'hippocamelus', 'hybomys', 'hylomyscus', 'hylopetes', 'hypogeomys',
        'ichneumia', 'arundinax', 'jynx', 'lagidium', 'lamprotornis',
        'laniarius', 'lanius', 'lariscus', 'lemur', 'leptotila',
        'lissotis', 'litocranius', 'lophotibis', 'lutreolina', 'lycalopex',
        'malacomys', 'melierax', 'melocichla', 'mesembrinibis',
        'chloropicus', 'metachirus', 'micrastur', 'microcebus',
        'microgale', 'microsciurus', 'mirafra', 'molothrus', 'monasa',
        'morphnus', 'motacilla', 'mungos', 'mus', 'musophaga', 'mydaus',
        'myoprocta', 'mystacornis', 'nandinia', 'cyanomitra', 'oressochen',
        'neocossyphus', 'neofelis', 'neomorphus', 'delacourella',
        'streptopelia', 'nesomys', 'nesotragus', 'niltava', 'nothocrax',
        'numida', 'nyctidromus', 'odontophorus', 'oenomys', 'oenanthe',
        'otolemur', 'otus', 'oxylabes', 'paleosuchus', 'pan', 'paraxerus',
        'pernis', 'petrodromus', 'phaethornis', 'philander', 'philantomba',
        'pilherodius', 'xanthomixis', 'pipile', 'ploceus', 'poecilogale',
        'pogonocichla', 'potos', 'praomys', 'presbytis', 'procavia',
        'piliocolobus', 'proechimys', 'propithecus', 'protoxerus',
        'psophia', 'pteroglossus', 'ramphastos', 'rana', 'rhea',
        'rhizomys', 'rhynchocyon', 'rollulus', 'rupornis', 'ruwenzorornis',
        'salanoia', 'saxicola', 'setifer', 'sheppardia', 'plestiodon',
        'spilogale', 'spizaetus', 'stephanoaetus', 'stigmochelys',
        'amazona', 'suncus', 'sundasciurus', 'tauraco', 'tenrec',
        'terpsiphone', 'thamnomys', 'thryonomys', 'tockus', 'tolypeutes',
        'tragulus', 'tremarctos', 'trichys', 'tupinambis', 'turtur',
        'tyto', 'vicugna', 'viverricula', 'xenoperdix', 'euxerus',
        'zonotrichia', 'erinaceus'
    ]),
    "species": datasets.ClassLabel(num_classes=668, names=[
        'taxidea taxus', 'lynx rufus', 'felis catus', 'bos taurus',
        'canis latrans', 'canis familiaris', 'urocyon cinereoargenteus',
        'puma concolor', 'didelphis virginiana', 'sus scrofa',
        'procyon lotor', 'urocyon littoralis', 'homo sapiens',
        'ursus americanus', 'corvus brachyrhynchos', 'gallus gallus',
        'tamias striatus', 'sylvilagus floridanus', 'sciurus niger',
        'sciurus carolinensis', 'equus caballus', 'vulpes vulpes',
        'mephitis mephitis', 'odocoileus virginianus',
        'meleagris gallopavo', 'marmota monax', 'ovis canadensis',
        'nucifraga columbiana', 'cervus canadensis', 'mustela erminea',
        'pekania pennanti', 'neogale frenata', 'pica hudsonia',
        'alces alces', 'erethizon dorsatum', 'antilocapra americana',
        'corvus corax', 'sitta canadensis', 'ixoreus naevius',
        'piranga ludoviciana', 'canis lupus', 'falco sparverius',
        'strix varia', 'anous stolidus', 'athene cunicularia',
        'nasua nasua', 'equus asinus', 'capra hircus', 'ardea herodias',
        'butorides virescens', 'calcinus tubularis', 'falco tinnunculus',
        'caloenas nicobarica', 'asio flammeus', 'hydrobates pelagicus',
        'zenaida asiatica', 'nyctanassa violacea', 'dasyprocta coibae',
        'pecari tajacu', 'didelphis marsupialis', 'lepus europaeus',
        'tinamus major', 'ovis ammon', 'leopardus pardalis',
        'mazama americana', 'cervus elaphus', 'tamiasciurus hudsonicus',
        'rattus praetor', 'nasua narica', 'apodemus sylvaticus',
        'callipepla californica', 'cyanocitta stelleri',
        'dasypus novemcinctus', 'dendragapus obscurus', 'equus africanus',
        'equus ferus', 'junco hyemalis', 'lepus americanus',
        'lepus californicus', 'lontra canadensis', 'marmota flaviventris',
        'martes americana', 'meles meles', 'odocoileus hemionus',
        'otospermophilus beecheyi', 'perisoreus canadensis',
        'rattus rattus', 'troglodytes aedon', 'zenaida macroura',
        'momotus momota', 'dasyprocta fuliginosa', 'speothos venaticus',
        'hydrochoerus hydrochaeris', 'iguana iguana', 'cerdocyon thous',
        'mitu tomentosum', 'tigrisoma fasciatum',
        'myrmecophaga tridactyla', 'priodontes maximus',
        'pteronura brasiliensis', 'panthera onca',
        'herpailurus yagouaroundi', 'tapirus terrestris', 'sapajus apella',
        'leopardus wiedii', 'lontra longicaudis', 'sciurus igniventris',
        'dasyprocta guamara', 'plecturocebus ornatus', 'mitu salvini',
        'tamandua tetradactyla', 'penelope jacquacu', 'cuniculus paca',
        'eira barbara', 'cathartes aura', 'penelope jacucaca',
        'tayassu pecari', 'orycteropus afer', 'proteles cristatus',
        'damaliscus pygargus', 'syncerus caffer', 'potamochoerus larvatus',
        'ardeotis kori', 'caracal caracal', 'anthropoides paradiseus',
        'sylvicapra grimmia', 'tragelaphus oryx', 'dama dama',
        'otocyon megalotis', 'oryx gazella', 'lepus saxatilis',
        'pedetes capensis', 'alcelaphus buselaphus', 'lupulella mesomelas',
        'oreotragus oreotragus', 'tragelaphus strepsiceros',
        'suricata suricatta', 'herpestes ichneumon',
        'cynictis penicillata', 'chlorocebus pygerythrus',
        'struthio camelus', 'hystrix africaeaustralis',
        'redunca fulvorufula', 'pelea capreolus',
        'sagittarius serpentarius', 'antidorcas marsupialis',
        'raphicerus campestris', 'connochaetes gnou', 'equus zebra',
        'ictonyx striatus', 'tragelaphus scriptus', 'acinonyx jubatus',
        'loxodonta africana', 'nanger granti', 'eudorcas thomsonii',
        'giraffa camelopardalis', 'lepus victoriae',
        'hippopotamus amphibius', 'crocuta crocuta', 'aepyceros melampus',
        'panthera pardus', 'panthera leo', 'ourebia ourebi',
        'hystrix cristata', 'damaliscus lunatus', 'phacochoerus africanus',
        'kobus ellipsiprymnus', 'connochaetes taurinus', 'equus quagga',
        'neotis ludwigii', 'vulpes chama', 'parahyaena brunnea',
        'herpestes pulverulentus', 'bunolagus monticularis',
        'diceros bicornis', 'felis lybica', 'lepus capensis',
        'mellivora capensis', 'crocodylus niloticus',
        'cephalophus natalensis', 'lupulella adusta',
        'tragelaphus angasii', 'pronolagus randensis',
        'hippotragus equinus', 'leptailurus serval', 'lycaon pictus',
        'ceratotherium simum', 'hyaena hyaena', 'nesolagus timminsi',
        'irena puella', 'ursus thibetanus', 'atherurus macrourus',
        'mustela strigidorsa', 'hydrornis elliotii', 'macropygia unchall',
        'varanus bengalensis', 'arctictis binturong', 'ratufa bicolor',
        'pterorhinus chinensis', 'cinclidium frontale',
        'hydrornis cyaneus', 'myophonus caeruleus', 'strix leptogrammica',
        'moschiola meminna', 'capricornis sumatraensis', 'cissa chinensis',
        'paradoxurus hermaphroditus', 'urva urva', 'rheinardia ocellata',
        'spilornis cheela', 'chalcophaps indica', 'scolopax rusticola',
        'turdus obscurus', 'trachypithecus francoisi',
        'cyanoderma chrysaeum', 'catopuma temminckii', 'garrulax maesi',
        'culicicapa ceylonensis', 'polyplectron bicalcaratum',
        'trachypithecus hatinhensis', 'arctonyx collaris',
        'cissa hypoleuca', 'turdus cardis', 'muntiacus vuquangensis',
        'viverra zibetha', 'erythrogenys hypoleucos',
        'prionailurus bengalensis', 'picus chlorolophus',
        'hystrix brachyura', 'pardofelis marmorata', 'paguma larvata',
        'nisaetus nipalensis', 'ducula badia', 'pterorhinus pectoralis',
        'tupaia belangeri', 'harpactes oreskios', 'geokichla citrina',
        'chrotogale owstoni', 'callosciurus erythraeus',
        'trachypithecus phayrei', 'macaca nemestrina',
        'dremomys rufigenis', 'picus rabieri', 'muntiacus muntjak',
        'pygathrix nemaeus', 'trochalopteron milnei',
        'muntiacus rooseveltorum', 'garrulax castanotis',
        'ianthocincla konkakinhensis', 'aceros nipalensis',
        'rusa unicolor', 'zoothera dauma', 'geokichla sibirica',
        'leiothrix argentauris', 'lophura nycthemera',
        'prionodon pardicolor', 'butorides striata', 'macaca arctoides',
        'helarctos malayanus', 'enicurus leschenaulti', 'myiomela leucura',
        'urocissa whiteheadi', 'mustela kathiah', 'martes flavigula',
        'accipiter madagascariensis', 'accipiter melanoleucus',
        'acrocephalus baeticatus', 'acryllium vulturinum', 'agamia agami',
        'alectoris rufa', 'chamaetylas poliophrys', 'alophoixus bres',
        'alopochen aegyptiaca', 'alouatta sara',
        'stelgidillas gracilirostris', 'eurillas latirostris',
        'eurillas virens', 'anhima cornuta', 'anomalurus derbianus',
        'aonyx cinereus', 'aquila heliaca', 'aquila rapax',
        'aramides cajaneus', 'aramus guarauna',
        'arborophila brunneopectus', 'arborophila rubrirostris',
        'arborophila rufogularis', 'arctogalidia trivirgata',
        'arctonyx hoevenii', 'ardea alba', 'ardea cocoi',
        'ardea melanocephala', 'ardeola grayii', 'argusianus argus',
        'arremonops chloronotus', 'asio madagascariensis',
        'atelerix albiventris', 'ateles chamek', 'atelocynus microtis',
        'atelornis pittoides', 'atherurus africanus', 'atilax paludinosus',
        'balearica regulorum', 'bambusicola fytchii',
        'baryphthengus martii', 'bdeogale crassicauda',
        'bdeogale jacksoni', 'blastocerus dichotomus', 'bos gaurus',
        'bostrychia hagedash', 'brachypteracias squamiger',
        'bubulcus ibis', 'burhinus capensis', 'butastur indicus',
        'buteo ridgwayi', 'buteogallus urubitinga', 'bycanistes brevis',
        'cabassous centralis', 'cabassous unicinctus', 'cairina moschata',
        'callosciurus notatus', 'caloperdix oculeus',
        'camelus dromedarius', 'mentocrex kioloides', 'capra aegagrus',
        'caracara plancus', 'carpococcyx renauldi',
        'cathartes burrovianus', 'cathartes melambrotus',
        'hylocichla mustelina', 'catharus ustulatus', 'cavia aperea',
        'cebus albifrons', 'cephalophus harveyi', 'cephalophus nigrifrons',
        'cephalophus silvicultor', 'cephalophus spadix',
        'cercocebus sanjei', 'cercopithecus erythrogaster',
        'allochrocebus lhoesti', 'cercopithecus mitis', 'ortalis vetula',
        'chelonoidis carbonarius', 'ciconia maguari',
        'cinclodes atacamensis', 'cinclodes fuscus', 'circus cyaneus',
        'cisticola cherina', 'civettictis civetta', 'claravis pretiosa',
        'cochlearius cochlearius', 'coendou bicolor', 'collocalia linchi',
        'colobus angolensis', 'colomys goslingi', 'columba arquatrix',
        'columba larvata', 'columbina talpacoti', 'conepatus chinga',
        'conepatus semistriatus', 'copsychus albospecularis',
        'copsychus malabaricus', 'copsychus saularis', 'coragyps atratus',
        'corythaixoides leucogaster', 'cossypha archeri',
        'coturnix delegorguei', 'coua caerulea', 'coua ruficeps',
        'coua serriana', 'crax alector', 'crax rubra',
        'cricetomys gambianus', 'cryptoprocta ferox',
        'crypturellus atrocapillus', 'crypturellus boucardi',
        'crypturellus cinereus', 'crypturellus cinnamomeus',
        'crypturellus erythropus', 'crypturellus bartletti',
        'crypturellus soui', 'crypturellus undulatus',
        'crypturellus variegatus', 'cuniculus taczanowskii',
        'cuon alpinus', 'cyanoptila cyanomelana', 'cyornis banyumas',
        'daptrius ater', 'dasyprocta punctata', 'dasyprocta leporina',
        'dasypus kappleri', 'daubentonia madagascariensis',
        'dendrocitta occipitalis', 'dendrohyrax arboreus',
        'ortygornis sephaena', 'deomys ferrugineus',
        'dicaeum trigonostigma', 'dicerorhinus sumatrensis',
        'dicrurus adsimilis', 'didelphis imperfecta', 'didelphis pernigra',
        'melaenornis fischeri', 'egretta thula', 'elephas maximus',
        'eliurus penicillatus', 'eliurus petteri', 'eliurus webbi',
        'enicurus schistaceus', 'equus grevyi', 'larvivora cyane',
        'erythrocebus patas', 'eudorcas rufifrons', 'eulemur albifrons',
        'euphractus sexcinctus', 'eupleres goudotii',
        'eupodotis senegalensis', 'eurocephalus ruppelli',
        'euryceros prevostii', 'eurypyga helias', 'eutriorchis astur',
        'felis chaus', 'felis silvestris', 'ficedula mugimaki',
        'ficedula tricolor', 'formicarius analis', 'formicarius colma',
        'fossa fossana', 'scleroptila afra', 'pternistis nobilis',
        'funisciurus carruthersi', 'funisciurus pyrropus',
        'galago senegalensis', 'galictis vittata', 'galidia elegans',
        'galidictis fasciata', 'genetta genetta', 'genetta maculata',
        'genetta servalina', 'genetta tigrina', 'geokichla gurneyi',
        'geotrygon montana', 'geotrygon saphirina', 'grallaria andicolus',
        'guttera pucherani', 'haliaeetus vociferoides', 'vanellus cayanus',
        'harpia harpyja', 'buteogallus solitarius',
        'heliosciurus rufobrachium', 'heliosciurus ruwenzorii',
        'helogale parvula', 'hemicentetes semispinosus',
        'hemigalus derbyanus', 'urosphena neumanni',
        'herpestes sanguineus', 'urva semitorquata', 'heterohyrax brucei',
        'hippocamelus antisensis', 'hybomys univittatus',
        'hydrornis oatesi', 'hylomyscus stella', 'hylopetes alboniger',
        'hypogeomys antimena', 'ichneumia albicauda', 'arundinax aedon',
        'jynx torquilla', 'lagidium viscacia', 'lamprotornis chalybaeus',
        'lamprotornis hildebrandti', 'lamprotornis superbus',
        'laniarius funebris', 'lanius collaris', 'lariscus insignis',
        'leopardus tigrinus', 'leptotila plumbeiceps',
        'leptotila rufaxilla', 'leptotila verreauxi',
        'lissotis hartlaubii', 'lissotis melanogaster',
        'litocranius walleri', 'lophotibis cristata', 'eupodotis gindiana',
        'lophura diardi', 'lophura erythrophthalma', 'lophura ignita',
        'lophura inornata', 'lutreolina crassicaudata',
        'lycalopex culpaeus', 'macaca assamensis', 'macaca fascicularis',
        'macaca mulatta', 'madoqua guentheri', 'malacomys longipes',
        'manis javanica', 'mazama temama', 'mazama chunyi',
        'mazama gouazoubira', 'odocoileus pandora',
        'melaenornis ardesiacus', 'melaenornis pammelaina',
        'meleagris ocellata', 'melierax poliopterus',
        'melocichla mentalis', 'melogale everetti', 'melogale personata',
        'mesembrinibis cayennensis', 'chloropicus griseocephalus',
        'metachirus nudicaudatus', 'microcebus murinus',
        'microsciurus flaviventer', 'microsciurus mimulus',
        'mitu tuberosum', 'molothrus oryzivorus', 'monasa morphoeus',
        'morphnus guianensis', 'motacilla flava', 'motacilla flaviventris',
        'mungos mungo', 'mus minutoides', 'musophaga rossae',
        'mustela lutreolina', 'mydaus javanensis', 'myophonus glaucinus',
        'myophonus melanurus', 'myoprocta pratti', 'mystacornis crossleyi',
        'nandinia binotata', 'cyanomitra cyanolaema', 'oressochen jubatus',
        'neocossyphus rufus', 'neofelis diardi', 'neofelis nebulosa',
        'neomorphus geoffroyi', 'neomorphus rufipennis',
        'delacourella capistrata', 'streptopelia picturata',
        'nesolagus netscheri', 'nesomys audeberti', 'nesotragus moschatus',
        'caprimulgus europaeus', 'niltava sumatrana', 'nisaetus nanus',
        'nothocrax urumutum', 'numida meleagris', 'nyctidromus albicollis',
        'odontophorus balliviani', 'odontophorus erythrops',
        'odontophorus gujanensis', 'oenomys hypoxanthus',
        'ortalis guttata', 'oryx beisa', 'otolemur garnettii',
        'otus spilocephalus', 'ovis aries', 'oxylabes madagascariensis',
        'pan troglodytes', 'panthera tigris', 'papio anubis',
        'papio cynocephalus', 'paraxerus boehmi', 'paraxerus cepapi',
        'paraxerus lucifer', 'paraxerus ochraceus',
        'paraxerus vexillarius', 'penelope purpurascens',
        'penelope superciliaris', 'pernis ptilorhynchus',
        'petrodromus tetradactylus', 'philander opossum',
        'philantomba monticola', 'pilherodius pileatus',
        'xanthomixis apperti', 'pipile cumanensis', 'pipile pipile',
        'hydrornis guajanus', 'hydrornis schneideri', 'ploceus alienus',
        'ploceus baglafecht', 'poecilogale albinucha',
        'pogonocichla stellata', 'polyplectron chalcurum',
        'erythrogenys mcclellandi', 'potos flavus', 'praomys tullbergi',
        'presbytis femoralis', 'presbytis thomasi', 'prionodon linsang',
        'procavia capensis', 'piliocolobus gordonorum',
        'procyon cancrivorus', 'propithecus candidus',
        'protoxerus stangeri', 'psophia crepitans', 'psophia leucoptera',
        'pternistis hildebrandti', 'pternistis leucoscepus',
        'pteroglossus beauharnaisii', 'ramphastos tucanus',
        'rattus tiomanicus', 'rhea americana', 'rhizomys sumatrensis',
        'rhynchocyon cirnei', 'rhynchocyon petersi',
        'rhynchocyon udzungwensis', 'rollulus rouloul',
        'rupornis magnirostris', 'ruwenzorornis johnstoni',
        'saimiri boliviensis', 'salanoia concolor', 'saxicola tectes',
        'sciurus deppei', 'sciurus granatensis', 'sciurus ignitus',
        'sciurus spadiceus', 'setifer setosus', 'sheppardia lowei',
        'spilogale putorius', 'spizaetus ornatus',
        'stephanoaetus coronatus', 'stigmochelys pardalis',
        'streptopelia capicola', 'streptopelia lugens',
        'streptopelia senegalensis', 'amazona oratrix', 'suncus murinus',
        'sundasciurus hippurus', 'sus barbatus', 'sylvilagus brasiliensis',
        'tamandua mexicana', 'tapirus bairdii', 'tapirus indicus',
        'tauraco livingstonii', 'tenrec ecaudatus', 'terpsiphone mutata',
        'thamnomys venustus', 'thryonomys gregorianus',
        'thryonomys swinderianus', 'tigrisoma lineatum',
        'tigrisoma mexicanum', 'tinamus guttatus', 'tinamus tao',
        'tockus deckeni', 'tockus flavirostris', 'tolypeutes matacus',
        'tragelaphus imberbis', 'tragulus javanicus', 'tragulus kanchil',
        'tragulus napu', 'tremarctos ornatus', 'trichys fasciculata',
        'tupaia glis', 'tupinambis teguixin', 'turdus ignobilis',
        'turdus olivaceus', 'turdus tephronotus', 'turtur chalcospilos',
        'turtur tympanistria', 'tyto alba', 'vanellus coronatus',
        'varanus salvator', 'vicugna pacos', 'viverricula indica',
        'xenoperdix udzungwensis', 'euxerus erythropus', 'xerus rutilus',
        'zonotrichia capensis', 'erinaceus europaeus', 'rattus norvegicus'
    ]),
    "subspecies": datasets.ClassLabel(num_classes=8, names=[
        'sciurus niger cinereus', 'alces alces americanus',
        'sapajus apella margaritae', 'damaliscus pygargus phillipsi',
        'alcelaphus buselaphus caama', 'damaliscus lunatus jimela',
        'equus quagga burchellii', 'zoothera dauma dauma'
    ]),
    "variety": datasets.ClassLabel(num_classes=1, names=[
        'gallus gallus domesticus'
    ]),
}


class LILAConfig(datasets.BuilderConfig):
    """Builder Config for LILA"""
    def __init__(self, image_base_url, metadata_url, **kwargs):
        super(LILAConfig, self).__init__(version=datasets.Version("1.0.0"), **kwargs)
        self.image_base_url = image_base_url
        self.metadata_url = metadata_url


class LILA(datasets.GeneratorBasedBuilder):
    """LILA Camera Traps is an aggregate wildlife camera trap dataset for ecological research."""
    VERSION = datasets.Version("1.1.0")

    BUILDER_CONFIGS = [
        LILAConfig(
            name=row.name,
            image_base_url=row.image_base_url,
            metadata_url=_METADATA_BASE_URL + _LILA_URLS[row.name]
        ) for row in _LILA_SAS_URLS.itertuples()
    ]

    def _get_features(self) -> datasets.Features:
        if self.config.name == 'Caltech Camera Traps':
            return datasets.Features({
                "file_name": datasets.Value("string"),
                "width": datasets.Value("int32"), "height": datasets.Value("int32"),
                "seq_num_frames": datasets.Value("int32"),
                "date_captured": datasets.Value("string"),
                "seq_id": datasets.Value("string"),
                "location": datasets.Value("string"),
                "rights_holder": datasets.Value("string"),
                "frame_num": datasets.Value("int32"),
                "annotations": datasets.Sequence({
                    "taxonomy": _TAXONOMY,
                }),
                "bboxes": datasets.Sequence({
                    "taxonomy": _TAXONOMY,
                    "bbox": datasets.Sequence(datasets.Value("float32")),
                }),
                "image": datasets.Value("string"),
            })
        elif self.config.name == 'ENA24':
            return datasets.Features({
                "file_name": datasets.Value("string"),
                "width": datasets.Value("int32"), "height": datasets.Value("int32"),
                "annotations": datasets.Sequence({
                    "bbox": datasets.Sequence(datasets.Value("float32")),
                    "taxonomy": _TAXONOMY,
                }),
                "image": datasets.Value("string"),
            })
        elif self.config.name == 'Missouri Camera Traps':
            return datasets.Features({
                "file_name": datasets.Value("string"),
                "width": datasets.Value("int32"), "height": datasets.Value("int32"),
                "seq_id": datasets.Value("string"), "seq_num_frames": datasets.Value("int32"),
                "frame_num": datasets.Value("int32"),
                "annotations": datasets.Sequence({
                    "sequence_level_annotation": datasets.Value("bool"),
                    "bbox": datasets.Sequence(datasets.Value("float32")),
                    "taxonomy": _TAXONOMY,
                }),
                "image": datasets.Value("string"),
            })
        elif self.config.name == 'NACTI':
            return datasets.Features({
                "file_name": datasets.Value("string"),
                "width": datasets.Value("int32"), "height": datasets.Value("int32"),
                "study": datasets.Value("string"), "location": datasets.Value("string"),
                "annotations": datasets.Sequence({
                    "taxonomy": _TAXONOMY,
                }),
                "bboxes": datasets.Sequence({
                    "bbox": datasets.Sequence(datasets.Value("float32")),
                }),
                "image": datasets.Value("string"),
            })
        elif self.config.name == 'WCS Camera Traps':
            return datasets.Features({
                "file_name": datasets.Value("string"),
                "width": datasets.Value("int32"), "height": datasets.Value("int32"),
                "wcs_id": datasets.Value("string"), "location": datasets.Value("string"),
                "frame_num": datasets.Value("int32"), "match_level": datasets.Value("int32"),
                "seq_id": datasets.Value("string"), "country_code": datasets.Value("string"),
                "seq_num_frames": datasets.Value("int32"),
                "status": datasets.Value("string"),
                "datetime": datasets.Value("string"),
                "corrupt": datasets.Value("bool"),
                "annotations": datasets.Sequence({
                    "count": datasets.Value("int32"),
                    "sex": datasets.Value("string"),
                    "age": datasets.Value("string"),
                    "taxonomy": _TAXONOMY,
                }),
                "bboxes": datasets.Sequence({
                    "bbox": datasets.Sequence(datasets.Value("float32")),
                }),
                "image": datasets.Value("string"),
            })
        elif self.config.name == 'Wellington Camera Traps':
            return datasets.Features({
                "file_name": datasets.Value("string"),
                "width": datasets.Value("int32"), "height": datasets.Value("int32"),
                "frame_num": datasets.Value("int32"), "seq_id": datasets.Value("string"),
                "site": datasets.Value("string"), "camera": datasets.Value("string"),
                "datetime": datasets.Value("string"),
                "annotations": datasets.Sequence({
                    "taxonomy": _TAXONOMY,
                }),
                "image": datasets.Value("string"),
            })
        elif self.config.name == 'Island Conservation Camera Traps':
            return datasets.Features({
                "file_name": datasets.Value("string"),
                "width": datasets.Value("int32"), "height": datasets.Value("int32"),
                "annotations": datasets.Sequence({
                    "bbox": datasets.Sequence(datasets.Value("float32")),
                    "taxonomy": _TAXONOMY,
                }),
                "image": datasets.Value("string"),
            })
        elif self.config.name == 'Channel Islands Camera Traps':
            return datasets.Features({
                "file_name": datasets.Value("string"),
                "width": datasets.Value("int32"), "height": datasets.Value("int32"),
                "frame_num": datasets.Value("int32"), "seq_id": datasets.Value("string"),
                "seq_num_frames": datasets.Value("int32"),
                "original_relative_path": datasets.Value("string"),
                "location": datasets.Value("string"),
                "temperature": datasets.Value("string"),
                "annotations": datasets.Sequence({
                    "sequence_level_annotation": datasets.Value("bool"),
                    "bbox": datasets.Sequence(datasets.Value("float32")),
                    "taxonomy": _TAXONOMY,
                }),
                "image": datasets.Value("string"),
            })
        elif self.config.name == 'Idaho Camera Traps':
            return datasets.Features({
                "file_name": datasets.Value("string"),
                "frame_num": datasets.Value("int32"), "seq_id": datasets.Value("string"),
                "seq_num_frames": datasets.Value("int32"),
                "original_relative_path": datasets.Value("string"),
                "datetime": datasets.Value("string"),
                "location": datasets.Value("string"),
                "annotations": datasets.Sequence({
                    "sequence_level_annotation": datasets.Value("bool"),
                    "taxonomy": _TAXONOMY,
                }),
                "image": datasets.Value("string"),
            })
        elif self.config.name == 'Snapshot Serengeti':
            return datasets.Features({
                "file_name": datasets.Value("string"),
                "frame_num": datasets.Value("int32"), "seq_id": datasets.Value("string"),
                "width": datasets.Value("int32"), "height": datasets.Value("int32"),
                "seq_num_frames": datasets.Value("int32"),
                "datetime": datasets.Value("string"),
                "corrupt": datasets.Value("bool"),
                "location": datasets.Value("string"),
                "annotations": datasets.Sequence({
                    "sequence_level_annotation": datasets.Value("bool"),
                    "seq_id": datasets.Value("string"),
                    "season": datasets.Value("string"),
                    "datetime": datasets.Value("string"),
                    "subject_id": datasets.Value("string"),
                    "count": datasets.Value("string"),
                    "standing": datasets.Value("float32"),
                    "resting": datasets.Value("float32"),
                    "moving": datasets.Value("float32"),
                    "interacting": datasets.Value("float32"),
                    "young_present": datasets.Value("float32"),
                    "location": datasets.Value("string"),
                    "taxonomy": _TAXONOMY,
                }),
                "bboxes": datasets.Sequence({
                    "bbox": datasets.Sequence(datasets.Value("float32")),
                }),
                "image": datasets.Value("string"),
            })
        elif self.config.name in [
            'Snapshot Karoo', 'Snapshot Kgalagadi', 'Snapshot Enonkishu', 'Snapshot Camdeboo',
            'Snapshot Mountain Zebra', 'Snapshot Kruger'
        ]:
            return datasets.Features({
                "file_name": datasets.Value("string"),
                "frame_num": datasets.Value("int32"), "seq_id": datasets.Value("string"),
                "width": datasets.Value("int32"), "height": datasets.Value("int32"),
                "seq_num_frames": datasets.Value("int32"),
                "datetime": datasets.Value("string"),
                "corrupt": datasets.Value("bool"),
                "location": datasets.Value("string"),
                "annotations": datasets.Sequence({
                    "sequence_level_annotation": datasets.Value("bool"),
                    "seq_id": datasets.Value("string"),
                    "season": datasets.Value("string"),
                    "datetime": datasets.Value("string"),
                    "subject_id": datasets.Value("string"),
                    "count": datasets.Value("string"),
                    "standing": datasets.Value("float32"),
                    "resting": datasets.Value("float32"),
                    "moving": datasets.Value("float32"),
                    "interacting": datasets.Value("float32"),
                    "young_present": datasets.Value("float32"),
                    "location": datasets.Value("string"),
                    "taxonomy": _TAXONOMY,
                }),
                "image": datasets.Value("string"),
            })
        elif self.config.name == 'SWG Camera Traps':
            return datasets.Features({
                "file_name": datasets.Value("string"),
                "width": datasets.Value("int32"), "height": datasets.Value("int32"),
                "location": datasets.Value("string"),
                "frame_num": datasets.Value("int32"),
                "seq_id": datasets.Value("string"),
                "seq_num_frames": datasets.Value("int32"),
                "datetime": datasets.Value("string"),
                "corrupt": datasets.Value("bool"),
                "annotations": datasets.Sequence({
                    "sequence_level_annotation": datasets.Value("bool"),
                    "taxonomy": _TAXONOMY,
                }),
                "bboxes": datasets.Sequence({
                    "sequence_level_annotation": datasets.Value("bool"),
                    "bbox": datasets.Sequence(datasets.Value("float32")),
                    "taxonomy": _TAXONOMY,
                }),
                "image": datasets.Value("string"),
            })
        elif self.config.name == 'Orinoquia Camera Traps':
            return datasets.Features({
                "file_name": datasets.Value("string"),
                "frame_num": datasets.Value("int32"), "seq_id": datasets.Value("string"),
                "seq_num_frames": datasets.Value("int32"), "datetime": datasets.Value("string"),
                "location": datasets.Value("string"),
                "annotations": datasets.Sequence({
                    "sequence_level_annotation": datasets.Value("bool"),
                    "taxonomy": _TAXONOMY,
                }),
                "image": datasets.Value("string"),
            })

    def _info(self):
        features = self._get_features()

        return datasets.DatasetInfo(
            description=_DESCRIPTION,
            features=features,
            homepage=_HOMEPAGE,
            citation=_LILA_CITATIONS[self.config.name],
        )

    def _split_generators(self, dl_manager):
        archive_path = dl_manager.download_and_extract(self.config.metadata_url)
        if archive_path.endswith(".zip") or os.path.isdir(archive_path):
            archive_path = os.path.join(archive_path, os.listdir(archive_path)[0])

        return [
            datasets.SplitGenerator(
                name=datasets.Split.TRAIN,
                gen_kwargs={
                    "filepath": archive_path,
                    "split": "train",
                },
            ),
        ]

    def _generate_examples(self, filepath, split):
        with open(filepath) as f:
            for line in f:
                example = json.loads(line)
                image_url = f"{self.config.image_base_url}/{example['file_name']}"
                yield example["file_name"], {
                    **example,
                    "image": image_url
                }