Datasets:
Evaluate test-set options
#3
by egrace479 - opened
Files changed (36)
- .gitattributes+18
- README.md+126-5
- data/potential-test-sets/Desert_Lion_Conservation_Camera_Traps_image_urls_and_labels.csvAdded+3
- data/potential-test-sets/ENA24_image_urls_and_labels.csvAdded
- data/potential-test-sets/Island_Conservation_Camera_Traps_image_urls_and_labels.csvAdded+3
- data/potential-test-sets/Ohio_Small_Animals_image_urls_and_labels.csvAdded+3
- data/potential-test-sets/Orinoquia_Camera_Traps_image_urls_and_labels.csvAdded+3
- data/potential-test-sets/SWG_Camera_Traps_image_urls_and_labels.csvAdded+3
- data/potential-test-sets/Snapshot_Safari_2024_Expansion_image_urls_and_labels.csvAdded+3
- data/potential-test-sets/filtered/ENA24-balanced-small.csvAdded
- data/potential-test-sets/filtered/ENA24-balanced.csvAdded
- data/potential-test-sets/filtered/ENA24-imbalanced.csvAdded
- data/potential-test-sets/filtered/desert-lion-balanced.csvAdded
- data/potential-test-sets/filtered/desert-lion-upper-bound.csvAdded+3
- data/potential-test-sets/filtered/desert-lion-upper-lower-bound.csvAdded+3
- data/potential-test-sets/filtered/island-balanced.csvAdded
- data/potential-test-sets/filtered/island-imbalanced_common.csvAdded+3
- data/potential-test-sets/filtered/island-imbalanced_family.csvAdded+3
- data/potential-test-sets/filtered/island-lower-bound_common.csvAdded+3
- data/potential-test-sets/filtered/island-lower-bound_family.csvAdded+3
- data/potential-test-sets/filtered/ohio-small-animals-balanced.csvAdded
- data/potential-test-sets/filtered/ohio-small-animals-upper-bound.csvAdded+3
- data/potential-test-sets/filtered/ohio-small-animals-upper-bound_checksums.csvAdded+3
- data/potential-test-sets/filtered/ohio-small-animals-upper-lower-bound.csvAdded+3
- data/potential-test-sets/filtered/orinoquia-balanced.csvAdded
- data/potential-test-sets/filtered/orinoquia-upper-bound.csvAdded+3
- data/potential-test-sets/filtered/orinoquia-upper-lower-bound.csvAdded+3
- data/potential-test-sets/lila-taxonomy-mapping_release.csvAdded
- data/potential-test-sets/lila_image_urls_and_labels.csvAdded+3
- notebooks/lilabc_test-ENA24.ipynbAdded
- notebooks/lilabc_test-desert-lion.ipynbAdded
- notebooks/lilabc_test-filter.ipynbAdded
- notebooks/lilabc_test-filter.pyAdded+306
- notebooks/lilabc_test-island.ipynbAdded
- notebooks/lilabc_test-ohio-small-animal.ipynbAdded
- notebooks/lilabc_test-orinoquia.ipynbAdded
55 unmodified lines56575855 unmodified lineslila_image_urls_and_labels.csv filter=lfs diff=lfs merge=lfs -textdata/lila_image_urls_and_labels_species.csv filter=lfs diff=lfs merge=lfs -textdata/lila_image_urls_and_labels_wHumans.csv filter=lfs diff=lfs merge=lfs -text55 unmodified lines56575859606162636465666768697071727374757655 unmodified lineslila_image_urls_and_labels.csv filter=lfs diff=lfs merge=lfs -textdata/lila_image_urls_and_labels_species.csv filter=lfs diff=lfs merge=lfs -textdata/lila_image_urls_and_labels_wHumans.csv filter=lfs diff=lfs merge=lfs -textdata/potential-test-sets/lila_image_urls_and_labels.csv filter=lfs diff=lfs merge=lfs -textdata/potential-test-sets/Desert_Lion_Conservation_Camera_Traps_image_urls_and_labels.csv filter=lfs diff=lfs merge=lfs -textdata/potential-test-sets/Island_Conservation_Camera_Traps_image_urls_and_labels.csv filter=lfs diff=lfs merge=lfs -textdata/potential-test-sets/Ohio_Small_Animals_image_urls_and_labels.csv filter=lfs diff=lfs merge=lfs -textdata/potential-test-sets/Orinoquia_Camera_Traps_image_urls_and_labels.csv filter=lfs diff=lfs merge=lfs -textdata/potential-test-sets/Snapshot_Safari_2024_Expansion_image_urls_and_labels.csv filter=lfs diff=lfs merge=lfs -textdata/potential-test-sets/SWG_Camera_Traps_image_urls_and_labels.csv filter=lfs diff=lfs merge=lfs -textdata/potential-test-sets/filtered/desert-lion-upper-bound.csv filter=lfs diff=lfs merge=lfs -textdata/potential-test-sets/filtered/desert-lion-upper-lower-bound.csv filter=lfs diff=lfs merge=lfs -textdata/potential-test-sets/filtered/ohio-small-animals-upper-bound.csv filter=lfs diff=lfs merge=lfs -textdata/potential-test-sets/filtered/ohio-small-animals-upper-lower-bound.csv filter=lfs diff=lfs merge=lfs -textdata/potential-test-sets/filtered/orinoquia-upper-bound.csv filter=lfs diff=lfs merge=lfs -textdata/potential-test-sets/filtered/orinoquia-upper-lower-bound.csv filter=lfs diff=lfs merge=lfs -textdata/potential-test-sets/filtered/island-imbalanced_common.csv filter=lfs diff=lfs merge=lfs -textdata/potential-test-sets/filtered/island-imbalanced_family.csv filter=lfs diff=lfs merge=lfs -textdata/potential-test-sets/filtered/island-lower-bound_common.csv filter=lfs diff=lfs merge=lfs -textdata/potential-test-sets/filtered/island-lower-bound_family.csv filter=lfs diff=lfs merge=lfs -textdata/potential-test-sets/filtered/ohio-small-animals-upper-bound_checksums.csv filter=lfs diff=lfs merge=lfs -text
1234558 unmodified lines64656667686919 unmodified lines899091929394959697989954 unmodified lines15415515615715815916016116216316416541 unmodified lines207208209210211212213214215216217218219220221---license: pddllanguage:- enpretty_name: LILA BC Camera Trap Data58 unmodified linesThis dataset contains the LILA BC full camera trap information with notebook ([`lilabc_CT.ipynb`](https://huggingface.co/datasets/imageomics/lila-bc-camera/blob/main/notebooks/lilabc_CT.ipynb)) exploring available data. The last run of this (in [commit 010ecf0](https://huggingface.co/datasets/imageomics/lila-bc-camera/commit/010ecf0c6a2e0c99c9481cea793d8b1556b5c71e)) uses and produces the lila CSVs found [here](https://huggingface.co/datasets/imageomics/lila-bc-camera/tree/010ecf0c6a2e0c99c9481cea793d8b1556b5c71e/data).More details on this are below in [Data Instances](#data-instances).**Repo file description at [commit 87e2e4d](https://huggingface.co/datasets/imageomics/lila-bc-camera/tree/87e2e4d46cf1e8daadd74b7738856a1e30754de3) when we were considering it for BioCLIP v1 testing:**Images have been deduplicated and reduced down to species designation, with the main CSV filtered to just those with species labels and only one animal per image. This was done by pulling the first instance of an animal so that there are not repeat images of the same animal from essentially the same time.19 unmodified lineslila_image_urls_and_labels.csvlila_image_urls_and_labels_species.csv # Outdatedlila_image_urls_and_labels_wHumans.csvnotebooks/lilabc_CT.ipynblilabc_CT.py```### Data Instances54 unmodified linesSnapshot Camdeboo 3```### Data Fields[More Information Needed]<!--Describe the types of the data files or the columns in a CSV with metadata.-->### Data Splits[More Information Needed]<!--41 unmodified lines## Additional Information### Dataset Curators[More Information Needed]### Licensing Information[More Information Needed]Be sure to check the license requirements for the particular data used (as noted in the [LILA BC Licensing Information Section](https://huggingface.co/datasets/society-ethics/lila_camera_traps#licensing-information)).This particular compilation has been marked as dedicated to the public domain by applying the [CC0 Public Domain Waiver](https://creativecommons.org/publicdomain/zero/1.0/). However, images may be licensed under different terms (as noted above).### Citation Information[More Information Needed]<!--If you want to include BibTex, replace "<>"s with your info1234558 unmodified lines6465666768697071727374757677787980818283848519 unmodified lines10510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714854 unmodified lines20320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527641 unmodified lines318319320321322323324325326327328329330331332333334335336337338339340341342---license: cdla-permissive-1.0language:- enpretty_name: LILA BC Camera Trap Data58 unmodified linesThis dataset contains the LILA BC full camera trap information with notebook ([`lilabc_CT.ipynb`](https://huggingface.co/datasets/imageomics/lila-bc-camera/blob/main/notebooks/lilabc_CT.ipynb)) exploring available data. The last run of this (in [commit 010ecf0](https://huggingface.co/datasets/imageomics/lila-bc-camera/commit/010ecf0c6a2e0c99c9481cea793d8b1556b5c71e)) uses and produces the lila CSVs found [here](https://huggingface.co/datasets/imageomics/lila-bc-camera/tree/010ecf0c6a2e0c99c9481cea793d8b1556b5c71e/data).More details on this are below in [Data Instances](#data-instances).Looks at potential test sets constructed from 7 different LILA datasets (uses [data/potential-test-sets/lila_image_urls_and_labels.csv](https://huggingface.co/datasets/imageomics/lila-bc-camera/blob/37b93ddf25c63bc30d8488ef78c1a53b9c4a3115/data/potential-test-sets/lila_image_urls_and_labels.csv) (sha256:3fdf87ceea75f8720208a95350c3c70831a6c1c745a92bb68c7f2c3239e4c455) to separate them out):We're specifically interested in the following datasets identified in the [spreadsheet](https://docs.google.com/spreadsheets/d/1sC90DolAvswDUJ1lNSf0sk_norR24LwzX2O4g9OxMZE/edit?usp=drive_link) as labeled at the image-level.- [Snapshot Safari 2024 Expansion](https://lila.science/datasets/snapshot-safari-2024-expansion/)- [Ohio Small Animals](https://lila.science/datasets/ohio-small-animals/)- [Desert Lion Conservation Camera Traps](https://lila.science/datasets/desert-lion-conservation-camera-traps/)- [Orinoquia Camera Traps](https://lila.science/datasets/orinoquia-camera-traps/)- [SWG Camera Traps 2018-2020](https://lila.science/datasets/swg-camera-traps)- [Island Conservation Camera Traps](https://lila.science/datasets/island-conservation-camera-traps/)- [ENA24-detection](https://lila.science/datasets/ena24detection)There are 2,867,312 images in this subset (once humans and non-creatures are removed).[NOAA Puget Sound Nearshore Fish 2017-2018](https://lila.science/datasets/noaa-puget-sound-nearshore-fish) could be interesting for the combined categories, though it is _very_ general (has only three labels: `fish`, `crab`, `fish_and_crab`). It also isn't included in the CSV, so not explored further.More details on this provided in [Test Data Instances](#test-data-instances), below.**Repo file description at [commit 87e2e4d](https://huggingface.co/datasets/imageomics/lila-bc-camera/tree/87e2e4d46cf1e8daadd74b7738856a1e30754de3) when we were considering it for BioCLIP v1 testing:**Images have been deduplicated and reduced down to species designation, with the main CSV filtered to just those with species labels and only one animal per image. This was done by pulling the first instance of an animal so that there are not repeat images of the same animal from essentially the same time.19 unmodified lineslila_image_urls_and_labels.csvlila_image_urls_and_labels_species.csv # Outdatedlila_image_urls_and_labels_wHumans.csvpotential-test-sets/lila-taxonomy-mapping_release.csvlila_image_urls_and_labels.csvfiltered/ENA24-imbalanced.csvENA24-balanced.csvENA24-balanced-small.csvdesert-lion-upper-lower-bound.csvdesert-lion-upper-bound.csvdesert-lion-balanced.csvisland-lower-bound_common.csvisland-lower-bound_family.csvisland-imbalanced_family.csvisland-balanced.csvisland-imbalanced_common.csvohio-small-animals-upper-lower-bound.csvohio-small-animals-upper-bound.csvohio-small-animals-balanced.csvorinoquia-upper-lower-bound.csvorinoquia-upper-bound.csvorinoquia-balanced.csvnotebooks/lilabc_CT.ipynblilabc_CT.pylilabc_test-<dataset_name>.ipynblilabc_test-EDA.pylilabc_test-filter.ipynblilabc_test-filter.py```**Notes:**- `dataset_name` is one of `desert-lion`, `ENA24`, `island`, `ohio-small-animal`, or `orinoquia`. Each collection of `<dataset_name>-<size_indicator>` CSVs are created in their corresponding `lilabc_test-<dataset_name>` notebook.- All the "balanced" datasets and `ENA24-balanced-small.csv` have 12 images per species (or family, in the case of the island-balanced CSV). `ENA24-balanced.csv` has 56 images per species.- `upper-bound` are max 10K images per species, with no minimum (this often means the smallest classification class has just 1 image).- `upper-lower-bound` CSVs are max 10K images per species and minimum of 10.- ENA24 has a minimum of 56 images per species and a maximum of 893, so `ENA24-imbalanced.csv` is just all images containing a single species.- The island camera traps were mostly only labeled to family level, so there are common name and family versions. The `imbalanced` sets are just all images with common name or family designation, respectively. The `lower-bound` are only those with at least ten images per class (by common name and family), and `balanced` is just 12 images per family.### Data Instances54 unmodified linesSnapshot Camdeboo 3```### Test Data Instances**data/potential-test-sets/lila_image_urls_and_labels.csv:** Reduced down to the datasets of interest listed below; all those with `original_label` "empty" or null `scientific_name` (these had non-taxa labels) were removed.Additionally, added a `multi_species` column (boolean to indicate multiple species are present in the image--it gets listed once for each species in the image) and a count of how many different species are in each of those images (`num_species` column).There are 367 unique scientific names in this subset (355 by full 7-rank), 184 unique among just those labeled at the image-level (180 by full 7-rank) (as indicated by the CSV).This was then subdivided into CSVs for each of the target datasets (`data/potential-test-sets/<dataset_name>_image_urls_and_labels.csv`).These were initially identified from our [master spreadsheet](https://docs.google.com/spreadsheets/d/1sC90DolAvswDUJ1lNSf0sk_norR24LwzX2O4g9OxMZE/edit?gid=0#gid=0), identifying image-level labeled datasets and those that are a meaningful measure of our biodiversity-focused model (e.g., includes rare species--those less-commonly seen, targeting areas with greater biodiversity).- [Snapshot Safari 2024 Expansion](https://lila.science/datasets/snapshot-safari-2024-expansion/) -- actually labeled by sequence, so not a good choice for testing- [Ohio Small Animals](https://lila.science/datasets/ohio-small-animals/)- [Desert Lion Conservation Camera Traps](https://lila.science/datasets/desert-lion-conservation-camera-traps/)- [Orinoquia Camera Traps](https://lila.science/datasets/orinoquia-camera-traps/)- [SWG Camera Traps 2018-2020](https://lila.science/datasets/swg-camera-traps) -- actually labeled by sequence, so not a good choice for testing- [Island Conservation Camera Traps](https://lila.science/datasets/island-conservation-camera-traps/)- [ENA24-detection](https://lila.science/datasets/ena24detection)Multi-species counts (full):```num_species1.0 27538322.0 1148253.0 139954.0 17045.0 23014.0 42```For Image-level labels:```num_species1.0 3058212.0 11543.0 3```Looks like we'll have about 306K images across the 5 datasets that have image-level labels.### Data Fields[More Information Needed]<!--Describe the types of the data files or the columns in a CSV with metadata.-->Each of the `<dataset_name>_<type>` CSVs has the following columns.- `dataset_name`: name of the LILA BC dataset- `url_gcp`, `url_aws`, `url_azure` are URLs to potentially access the image, we recommend `url_aws`.- `image_id`: unique identifier for the image.- `sequence_id`: ID of the sequence to which the image belongs.- `location_id`: ID of the location at which the camera was placed.- `frame_num`: generally 0, 1, or 2, indicates order of image within a sequence.- `original_label`: label initially assigned to the image.- `scientific_name`: genus species of the animal in the image. For the island CSV, lowest rank taxa available, generally family.- `common_name`: vernacular name of the animal in the image. For the island CSV, this is generally for the family, but it's a mix.- `kingdom`: kingdom of the animal in the image.- `phylum`: phylum of the animal in the image.- `class`: class of the animal in the image.- `order`: order of the animal in the image.- `family`: family of the animal in the image.- `genus`: genus of the animal in the image. About half null in the island CSVs.- `species`: species of the animal in the image. Mostly null in the island CSVs.- `num_sp_images`: number of images of that species in the dataset.For the island CSVs, instead of `num_sp_images` there are `num_fam_images` and `num_cn_images` representing the number of images for the family or common name, respectively.Additionally, the `ohio-small-animals` CSVs have a `filename` column defined as `OH_sm_animals_<filename in url_aws>`.### Data Splits[More Information Needed]<!--41 unmodified lines## Additional Information### Dataset CuratorsElizabeth Campolongo### Licensing InformationThis compilation is licensed under the [Community Data License Agreement (permissive variant)](https://cdla.io/permissive-1-0/), same as the images and metadata which belong to their original sources (see citation directions below).### Citation InformationFor test sets (provided citations on their LILA BC pages are included):- [Ohio Small Animals](https://lila.science/datasets/ohio-small-animals/)- Balasubramaniam S. [Optimized Classification in Camera Trap Images: An Approach with Smart Camera Traps, Machine Learning, and Human Inference](https://etd.ohiolink.edu/acprod/odb_etd/etd/r/1501/10?clear=10&p10_accession_num=osu1721417695430687). Master’s thesis, The Ohio State University. 2024.- [Desert Lion Conservation Camera Traps](https://lila.science/datasets/desert-lion-conservation-camera-traps/)- [Orinoquia Camera Traps](https://lila.science/datasets/orinoquia-camera-traps/)- Vélez J, McShea W, Shamon H, Castiblanco‐Camacho PJ, Tabak MA, Chalmers C, Fergus P, Fieberg J. [An evaluation of platforms for processing camera‐trap data using artificial intelligence](https://besjournals.onlinelibrary.wiley.com/doi/full/10.1111/2041-210X.14044). Methods in Ecology and Evolution. 2023 Feb;14(2):459-77.- [Island Conservation Camera Traps](https://lila.science/datasets/island-conservation-camera-traps/)- [ENA24-detection](https://lila.science/datasets/ena24detection)- Yousif H, Kays R, Zhihai H. Dynamic Programming Selection of Object Proposals for Sequence-Level Animal Species Classification in the Wild. IEEE Transactions on Circuits and Systems for Video Technology, 2019. ([bibtex](http://lila.science/wp-content/uploads/2019/12/hayder2019_bibtex.txt))[More Information Needed]<!--If you want to include BibTex, replace "<>"s with your info
123version https://git-lfs.github.com/spec/v1oid sha256:f72c145c8619f23f7b856ea5235d98ce6c5823b9aeff0a7a0561c043684f6f94size 71743955123version https://git-lfs.github.com/spec/v1oid sha256:15a2103732b73e74cf77c19bfee1e254b9347396e7073ead1733b6ee5aee3376size 42287905123version https://git-lfs.github.com/spec/v1oid sha256:4d1d9d6178296c4cab77872abaf40c3cc995d720f51b506d788a66813330d239size 102854067123version https://git-lfs.github.com/spec/v1oid sha256:e41a5b0f2902db6ea442692fe833b5b9c7c4213e0e6afbfc6ff0b17b740cfa81size 60893968123version https://git-lfs.github.com/spec/v1oid sha256:6c1f66b16dab6712356d3e6d643aa43d0eb256ea1c9f7e18df50c7317da96cc1size 851507848123version https://git-lfs.github.com/spec/v1oid sha256:f3d4b274c59cde4672bcf832d1f891b389c7224ccd1a0b531bc94ae6a4fd5ec0size 1239337039123version https://git-lfs.github.com/spec/v1oid sha256:49584e3f9cd7f9e5ac0458f366779ac2222917a1f86ad671d361018483f2a114size 60820880123version https://git-lfs.github.com/spec/v1oid sha256:be643e7b4eaaf1c46c5d1c55cd62d77184e55b8edab5a4f2e3c7d80782ca273fsize 56028990123version https://git-lfs.github.com/spec/v1oid sha256:c9f8a03083b8579603ca4bfaaff89b86fb5012ca28531dc27a006ea427e7e1f0size 41982648123version https://git-lfs.github.com/spec/v1oid sha256:a0fb2dfd80d2ef28630ecb276e9f2fb7a207c8cea009a1f4940545c749c0ff17size 37897112123version https://git-lfs.github.com/spec/v1oid sha256:9f94c73b999364cd152907272918e634de714d640b1cb69bb5f24f97eb357617size 37903096123version https://git-lfs.github.com/spec/v1oid sha256:d85c13874b9df3c86369115edf5c4fce3db36684bd47532eda16f84cb9e68a3dsize 37894148123version https://git-lfs.github.com/spec/v1oid sha256:84648e040cae2f0aafbf9ce0489a0233301fb2d935ff78089e4779d1628f19e6size 74160481123version https://git-lfs.github.com/spec/v1oid sha256:72456c743b741aeffd035a294bcb1f406670436a5d2215b43067799737e6cdc0size 12737032123version https://git-lfs.github.com/spec/v1oid sha256:7667248d1589e8dca60907590aef8680eae4072dc24e35ba20abe50bae027f54size 74136444123version https://git-lfs.github.com/spec/v1oid sha256:4436251d1f180d5cc93d3b02c437da256c3231771d2f1f6f42d0688e5eb4bf35size 35138377123version https://git-lfs.github.com/spec/v1oid sha256:063f0c2f6805690cadfb28d90e50fffaade7b2cc950a30c036ea47a7ec98f730size 29981911123version https://git-lfs.github.com/spec/v1oid sha256:4f741289c6a8f8d2a7eaf766f2eb9cad5fde419007a117bee2c3163c78a8d96esize 2372912218123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306# ---# jupyter:# jupytext:# formats: ipynb,py:percent# text_representation:# extension: .py# format_name: percent# format_version: '1.3'# jupytext_version: 1.16.0# kernelspec:# display_name: data-dev# language: python# name: python3# ---
# %%import pandas as pdimport seaborn as sns
sns.set_style("whitegrid")
# %% [markdown]# Load in LILA CSV from [this commit](https://huggingface.co/datasets/imageomics/lila-bc-camera/blob/37b93ddf25c63bc30d8488ef78c1a53b9c4a3115/data/potential-test-sets/lila_image_urls_and_labels.csv). (this will take a while)## sha256:3fdf87ceea75f8720208a95350c3c70831a6c1c745a92bb68c7f2c3239e4c455# size 15931383983
# %%df = pd.read_csv("../data/potential-test-sets/lila_image_urls_and_labels.csv", low_memory = False)df.head()
# %%df.columns
# %%df.annotation_level.value_counts()
# %% [markdown]# Annotation level indicates image vs sequence (or unknown), we specifically want those annotated at the image-level, since they should be "clean" images. Though we will want to label them with how many distinct species are in the image first.## We have 3,533,538 images labeled to the image-level.## ### Check Dataset Counts## 1. Make sure we have all datasets expected. We're specifically interested in:# - [Snapshot Safari 2024 Expansion](https://lila.science/datasets/snapshot-safari-2024-expansion/)# - [Ohio Small Animals](https://lila.science/datasets/ohio-small-animals/)# - [Desert Lion Conservation Camera Traps](https://lila.science/datasets/desert-lion-conservation-camera-traps/)# - [Orinoquia Camera Traps](https://lila.science/datasets/orinoquia-camera-traps/)# - [SWG Camera Traps 2018-2020](https://lila.science/datasets/swg-camera-traps)# - [Island Conservation Camera Traps](https://lila.science/datasets/island-conservation-camera-traps/)# - [NOAA Puget Sound Nearshore Fish 2017-2018](https://lila.science/datasets/noaa-puget-sound-nearshore-fish) could be interesting for the combined categories, though it is _very_ general (has only three labels: `fish`, `crab`, `fish_and_crab`).# 2. Check which/how many datasets are labeled to the image level (and check for match to [Andrey's spreadsheet](https://docs.google.com/spreadsheets/d/1sC90DolAvswDUJ1lNSf0sk_norR24LwzX2O4g9OxMZE/edit?usp=drive_link)).
# %%df.dataset_name.value_counts()
# %%df.groupby(["dataset_name"]).annotation_level.value_counts()
# %% [markdown]# It seems snapshot safari exapansion and SWG camera traps are not labeled at the image level, despite the indication in the spreadsheet...## The NOAA one isn't here, but that's okay. Let's also take a look at [ENA24](https://lila.science/datasets/ena24detection).## We'll subset to just the 7 identified, though we'll likely not continue with Snapshot Safari and SWG, since we want to make sure the test set labels are accurate.
# %%datasets_of_interest = ["Desert Lion Conservation Camera Traps", "Island Conservation Camera Traps", "Ohio Small Animals", "Orinoquia Camera Traps", "SWG Camera Traps", "Snapshot Safari 2024 Expansion", "ENA24"]
# %%reduced_df = df.loc[df["dataset_name"].isin(datasets_of_interest)].copy()reduced_df.head()
# %% [markdown]# Observe that we also now get multiple URL options; `url_aws` will likely be best/fastest for use with [`distributed-downloader`](https://github.com/Imageomics/distributed-downloader) to get the images.
# %%reduced_df.info(show_counts = True)
# %% [markdown]# Let's remove empty frames to get a better sense of what we have.
# %%df_cleaned = reduced_df.loc[reduced_df.original_label != "empty"].copy()df_cleaned.info(show_counts = True)
# %% [markdown]# Not all have a scientific name, though those could be the non-taxa labels.
# %%df_cleaned.loc[df_cleaned["scientific_name"].isna(), "original_label"].value_counts()
# %% [markdown]# These are clearly also labels to remove, so we can simply reduce down to only those with non-null `scientific_name` values as well.
# %%df_cleaned = df_cleaned.loc[~df_cleaned["scientific_name"].isna()].copy()df_cleaned.info(show_counts=True)
# %%df_cleaned.nunique()
# %% [markdown]# We have 368 unique `scientific_name` values, some of which were definitely just higher ranks (e.g., Aves), but there are 283 species, so somewhere between the two should be our biodiversity.## Interesting also to note that there are duplicate URLs here; these would be the indicators of multiple species in an image as they correspond to the number of unique image IDs. Though, those could also be the by-sequence images that we expected to be by-image.
# %%#double-check for humansdf_cleaned.loc[df_cleaned.species == "homo sapien"]
# %% [markdown]# ## Save the Reduced Data (no more "empty" labels)
# %%df_cleaned.to_csv("../data/potential-test-sets/lila_image_urls_and_labels.csv", index = False)
# %%print(df_cleaned.phylum.value_counts())print()print(df_cleaned["class"].value_counts())
# %% [markdown]# All images are in Animalia, as expected; we have 2 phyla represented and 8 classes:# - Predominantly Chordata, and within that phylum, Mammalia is the vast majority, though aves is about 10%.# - Note that not every image with a phylum label has a class label.# - Insecta, malacostraca, and arachnida are all in the class Arthropoda.## ### Label Multi-Species Images# We'll go by both the URL and image ID, which do seem to correspond to the same images (for uniqueness).
# %%df_cleaned["multi_species"] = df_cleaned.duplicated(subset = ["url_aws", "image_id"], keep = False)
df_cleaned.loc[df_cleaned["multi_species"]].nunique()
# %% [markdown]# We've got just under 63K images that have multiple species. We can figure out how many each of them have, and then move on to looking at images per sequence and other labeling info.
# %%multi_sp_imgs = list(df_cleaned.loc[df_cleaned["multi_species"], "image_id"].unique())
# %%for img in multi_sp_imgs: df_cleaned.loc[df_cleaned["image_id"] == img, "num_species"] = df_cleaned.loc[df_cleaned["image_id"] == img].shape[0] df_cleaned.head()
# %% [markdown]# Set all the non-multi species images to show 1 in the `num_species` column.
# %%df_cleaned.loc[df_cleaned["num_species"].isna(), "num_species"] = 1.0
df_cleaned.num_species.value_counts()
# %%df_cleaned.loc[df_cleaned["num_species"] == 14.0].sample(4)
# %% [markdown]# Found a typo above with the human check... seems all taxa are lowercase, but let's make sure it's enough to catch them all
# %%print("num homo sapiens: ", df_cleaned.loc[df_cleaned.species == "homo sapiens"].shape)df_cleaned.loc[df_cleaned["original_label"] == "human"].shape
# %% [markdown]# Did any of these factor in to the multi-species counts?
# %%df_cleaned.loc[(df_cleaned["species"] == "homo sapiens") & (df_cleaned["multi_species"])].shape
# %%df_cleaned.loc[(df_cleaned["species"] == "homo sapiens") & (df_cleaned["multi_species"])].sample(4)
# %% [markdown]# Let's fix those counts then.
# %%human_multi_species = list(df_cleaned.loc[(df_cleaned["species"] == "homo sapiens") & (df_cleaned["multi_species"]), "image_id"].unique())
for img in human_multi_species: df_cleaned.loc[df_cleaned["image_id"] == img, "num_species"] = df_cleaned.loc[df_cleaned["image_id"] == img, "num_species"] - 1
df_cleaned.num_species.value_counts()
# %% [markdown]# Actually remove human indicators
# %%df_cleaned = df_cleaned.loc[df_cleaned["species"] != "homo sapiens"].copy()
# %% [markdown]# Need to remove the images that have humans and other species too.
# %%df_cleaned = df_cleaned.loc[~df_cleaned["image_id"].isin(human_multi_species)].copy()
# %% [markdown]# #### Save this to CSV now we got those counts
# %%df_cleaned.to_csv("../data/potential-test-sets/lila_image_urls_and_labels.csv", index = False)
# %% [markdown]# ### Generate individual CSVs for the datasets
# %%for dataset in datasets_of_interest: df_cleaned.loc[df_cleaned["dataset_name"] == dataset].to_csv(dataset+"_image_urls_and_labels.csv", index = False)
# Manually moved these to the data/potential-test-sets/ directory and renamed to not have spaces in the filenames# (replaced spaces with underscores)
# %% [markdown]# Get some basic stats
# %%print(f"there are {df_cleaned.shape[0]} images")print(f"we have {df_cleaned['scientific_name'].nunique()} unique scientific names")print(f"when we filter for image-level labels, we have {df_cleaned.loc[df_cleaned['annotation_level'] == 'image', 'scientific_name'].nunique()} scientific names")
# %%df_cleaned.loc[df_cleaned['annotation_level'] == 'image', 'num_species'].value_counts()
# %% [markdown]# We will want to dedicate some more time to exploring some of these taxonomic counts, but we'll first look at the number of unique taxa (by Linnean 7-rank (`unique_7_tuple`)). We'll compare these to the number of unique scientific and common names, then perhaps add a count of number of creatures based on one of those labels. At that point we may save another copy of this CSV and start a new analysis notebook.
# %%df_cleaned.annotation_level.value_counts()
# %% [markdown]# Let's get a sense of total number of unique taxa, then separate out the by-image ones for unique taxa count there. Then we'll separate out each dataset into its own CSV for individual analysis.
# %% [markdown]# ### Taxonomic String Exploration
# %%lin_taxa = ['kingdom', 'phylum', 'class', 'order', 'family', 'genus', 'species']
# %% [markdown]# #### How many have all 7 Linnean ranks?
# %%df_all_taxa = df_cleaned.dropna(subset = lin_taxa)df_all_taxa[lin_taxa].info(show_counts = True)
# %%df_all_taxa_img = df_cleaned.loc[df_cleaned["annotation_level"] == "image"].dropna(subset = lin_taxa)df_all_taxa_img[lin_taxa].info(show_counts = True)
# %%df_cleaned.loc[df_cleaned["annotation_level"] == "image"].shape
# %% [markdown]# That's not too bad, considering some are definitely just common names or classes: 2,187,756 out of 2,867,312. ## 249,847 when we drop to just image-level annotations (out of 306,978).### Now how many different 7-tuples are there?## #### How many unique 7-tuples?
# %%#number of unique 7-tuples in full datasetdf_cleaned['lin_duplicate'] = df_cleaned.duplicated(subset = lin_taxa, keep = 'first')df_unique_lin_taxa = df_cleaned.loc[~df_cleaned['lin_duplicate']].copy()print(f"unique taxa in all: {df_unique_lin_taxa.shape[0]}")print(f"unique taxa in image-level labeled: {df_unique_lin_taxa.loc[df_unique_lin_taxa["annotation_level"] == "image"].shape[0]}")
# %% [markdown]# Pretty much aligns with the scientific name counts.
# %%df_unique_lin_taxa.scientific_name.nunique()
# %%df_unique_lin_taxa.loc[(df_unique_lin_taxa["scientific_name"].isna()) | (df_unique_lin_taxa["common_name"].isna())]
# %% [markdown]# Let's check out our top ten labels, scientific names, and common names. Then we'll save this cleaned metadata file.
# %%df_cleaned["original_label"].value_counts()[:10]
# %%df_cleaned["scientific_name"].value_counts()[:10]
# %%df_cleaned["common_name"].value_counts()[:10]
# %%sns.histplot(df_cleaned, y = 'class')
# %%sns.histplot(df_cleaned.loc[df_cleaned["class"].isin(["aves", "mammalia", "reptilia"])], y = 'order')
# %%.gitattributes+18
README.md+126-5
data/potential-test-sets/Desert_Lion_Conservation_Camera_Traps_image_urls_and_labels.csvAdded+3
data/potential-test-sets/ENA24_image_urls_and_labels.csvAdded
data/potential-test-sets/Island_Conservation_Camera_Traps_image_urls_and_labels.csvAdded+3
data/potential-test-sets/Ohio_Small_Animals_image_urls_and_labels.csvAdded+3
data/potential-test-sets/Orinoquia_Camera_Traps_image_urls_and_labels.csvAdded+3
data/potential-test-sets/SWG_Camera_Traps_image_urls_and_labels.csvAdded+3
data/potential-test-sets/Snapshot_Safari_2024_Expansion_image_urls_and_labels.csvAdded+3
data/potential-test-sets/filtered/ENA24-balanced-small.csvAdded
data/potential-test-sets/filtered/ENA24-balanced.csvAdded
data/potential-test-sets/filtered/ENA24-imbalanced.csvAdded
data/potential-test-sets/filtered/desert-lion-balanced.csvAdded
data/potential-test-sets/filtered/desert-lion-upper-bound.csvAdded+3
data/potential-test-sets/filtered/desert-lion-upper-lower-bound.csvAdded+3
data/potential-test-sets/filtered/island-balanced.csvAdded
data/potential-test-sets/filtered/island-imbalanced_common.csvAdded+3
data/potential-test-sets/filtered/island-imbalanced_family.csvAdded+3
data/potential-test-sets/filtered/island-lower-bound_common.csvAdded+3
data/potential-test-sets/filtered/island-lower-bound_family.csvAdded+3
data/potential-test-sets/filtered/ohio-small-animals-balanced.csvAdded
data/potential-test-sets/filtered/ohio-small-animals-upper-bound.csvAdded+3
data/potential-test-sets/filtered/ohio-small-animals-upper-bound_checksums.csvAdded+3
data/potential-test-sets/filtered/ohio-small-animals-upper-lower-bound.csvAdded+3
data/potential-test-sets/filtered/orinoquia-balanced.csvAdded
data/potential-test-sets/filtered/orinoquia-upper-bound.csvAdded+3
data/potential-test-sets/filtered/orinoquia-upper-lower-bound.csvAdded+3
data/potential-test-sets/lila-taxonomy-mapping_release.csvAdded
data/potential-test-sets/lila_image_urls_and_labels.csvAdded+3
notebooks/lilabc_test-ENA24.ipynbAdded
notebooks/lilabc_test-desert-lion.ipynbAdded
notebooks/lilabc_test-filter.ipynbAdded
notebooks/lilabc_test-filter.pyAdded+306
notebooks/lilabc_test-island.ipynbAdded
notebooks/lilabc_test-ohio-small-animal.ipynbAdded
notebooks/lilabc_test-orinoquia.ipynbAdded