lila_camera_traps / lila_camera_traps.py
Saeid's picture
Updated addresses of dataset files
eb35b93 verified
raw
history blame
52.5 kB
# 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"
_OLD_BASE_URL = "https://lilablobssc.blob.core.windows.net"
_NEW_BASE_URL = "https://lilawildlife.blob.core.windows.net/lila-wildlife"
_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)
_LILA_SAS_URLS["image_base_url"] = _LILA_SAS_URLS["image_base_url"].apply(lambda l: l.replace(_OLD_BASE_URL, _NEW_BASE_URL))
_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"),
"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
}