egrace479 commited on
Commit
d9c6a82
·
verified ·
1 Parent(s): fe34008

Evaluate test-set options (#3)

Browse files

- Add latest lila files for analysis of potential test sets (37b93ddf25c63bc30d8488ef78c1a53b9c4a3115)
- filter to datasets of interest, remove empties and non-taxa (089d554dd5147fee2c3f74d5377197ff622db7ea)
- Add number of species count and separate out metadata for each dataset (934d82ea4c0d3e0873650b5548c5bada3f9b4629)
- Update description and add analysis of potential test sets (d18307b285217d18b31d1a7b2c9091bb0873ade0)
- Add varied test sets for 4 of the LILA BC datasets (99fef5e13f9acae819a3c6b89475648db34156a3)
- Add notebooks generating the CSVs in data/potential-test-sets/filtered (76411b32ad29a63cad1cd2c48a467522e3231431)
- Add island datasets (1031f4e7a738f71b3a0728b3c2fa77310d3568bc)
- Add notebook generating Island data test sets (edb47a16925e73fdb3b6bed6f0ca4cfe6a94cc83)
- Add description of filtered test sets (b2b3bbd2d07b783fef1f74bfa80e50ab36e9f70c)
- Update ohio small animals CSVs with filename column (1658ae3ea49a220fce039f95022f4b97d8297d5c)
- remove checksum duplicates (b1f27897874ae8f9077bfdfb210c9d1e636c78dd)
- remove checksum duplicates (incl. mislabel) (8bb184eabf6808a7e63c9f61cd3c7fcc804b15ac)
- Add MD5 hash for original and resized images (71603c9d0ae81a7fc537643a08fd8b3ca061c0be)
- update licensing (0aeeb210d440ff27a7ddc11f02318c3ba35beab6)

Files changed (36) hide show
  1. .gitattributes +18 -0
  2. README.md +126 -5
  3. data/potential-test-sets/Desert_Lion_Conservation_Camera_Traps_image_urls_and_labels.csv +3 -0
  4. data/potential-test-sets/ENA24_image_urls_and_labels.csv +0 -0
  5. data/potential-test-sets/Island_Conservation_Camera_Traps_image_urls_and_labels.csv +3 -0
  6. data/potential-test-sets/Ohio_Small_Animals_image_urls_and_labels.csv +3 -0
  7. data/potential-test-sets/Orinoquia_Camera_Traps_image_urls_and_labels.csv +3 -0
  8. data/potential-test-sets/SWG_Camera_Traps_image_urls_and_labels.csv +3 -0
  9. data/potential-test-sets/Snapshot_Safari_2024_Expansion_image_urls_and_labels.csv +3 -0
  10. data/potential-test-sets/filtered/ENA24-balanced-small.csv +0 -0
  11. data/potential-test-sets/filtered/ENA24-balanced.csv +0 -0
  12. data/potential-test-sets/filtered/ENA24-imbalanced.csv +0 -0
  13. data/potential-test-sets/filtered/desert-lion-balanced.csv +0 -0
  14. data/potential-test-sets/filtered/desert-lion-upper-bound.csv +3 -0
  15. data/potential-test-sets/filtered/desert-lion-upper-lower-bound.csv +3 -0
  16. data/potential-test-sets/filtered/island-balanced.csv +0 -0
  17. data/potential-test-sets/filtered/island-imbalanced_common.csv +3 -0
  18. data/potential-test-sets/filtered/island-imbalanced_family.csv +3 -0
  19. data/potential-test-sets/filtered/island-lower-bound_common.csv +3 -0
  20. data/potential-test-sets/filtered/island-lower-bound_family.csv +3 -0
  21. data/potential-test-sets/filtered/ohio-small-animals-balanced.csv +0 -0
  22. data/potential-test-sets/filtered/ohio-small-animals-upper-bound.csv +3 -0
  23. data/potential-test-sets/filtered/ohio-small-animals-upper-bound_checksums.csv +3 -0
  24. data/potential-test-sets/filtered/ohio-small-animals-upper-lower-bound.csv +3 -0
  25. data/potential-test-sets/filtered/orinoquia-balanced.csv +0 -0
  26. data/potential-test-sets/filtered/orinoquia-upper-bound.csv +3 -0
  27. data/potential-test-sets/filtered/orinoquia-upper-lower-bound.csv +3 -0
  28. data/potential-test-sets/lila-taxonomy-mapping_release.csv +0 -0
  29. data/potential-test-sets/lila_image_urls_and_labels.csv +3 -0
  30. notebooks/lilabc_test-ENA24.ipynb +0 -0
  31. notebooks/lilabc_test-desert-lion.ipynb +0 -0
  32. notebooks/lilabc_test-filter.ipynb +0 -0
  33. notebooks/lilabc_test-filter.py +306 -0
  34. notebooks/lilabc_test-island.ipynb +0 -0
  35. notebooks/lilabc_test-ohio-small-animal.ipynb +0 -0
  36. notebooks/lilabc_test-orinoquia.ipynb +0 -0
.gitattributes CHANGED
@@ -56,3 +56,21 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
56
  lila_image_urls_and_labels.csv filter=lfs diff=lfs merge=lfs -text
57
  data/lila_image_urls_and_labels_species.csv filter=lfs diff=lfs merge=lfs -text
58
  data/lila_image_urls_and_labels_wHumans.csv filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  lila_image_urls_and_labels.csv filter=lfs diff=lfs merge=lfs -text
57
  data/lila_image_urls_and_labels_species.csv filter=lfs diff=lfs merge=lfs -text
58
  data/lila_image_urls_and_labels_wHumans.csv filter=lfs diff=lfs merge=lfs -text
59
+ data/potential-test-sets/lila_image_urls_and_labels.csv filter=lfs diff=lfs merge=lfs -text
60
+ data/potential-test-sets/Desert_Lion_Conservation_Camera_Traps_image_urls_and_labels.csv filter=lfs diff=lfs merge=lfs -text
61
+ data/potential-test-sets/Island_Conservation_Camera_Traps_image_urls_and_labels.csv filter=lfs diff=lfs merge=lfs -text
62
+ data/potential-test-sets/Ohio_Small_Animals_image_urls_and_labels.csv filter=lfs diff=lfs merge=lfs -text
63
+ data/potential-test-sets/Orinoquia_Camera_Traps_image_urls_and_labels.csv filter=lfs diff=lfs merge=lfs -text
64
+ data/potential-test-sets/Snapshot_Safari_2024_Expansion_image_urls_and_labels.csv filter=lfs diff=lfs merge=lfs -text
65
+ data/potential-test-sets/SWG_Camera_Traps_image_urls_and_labels.csv filter=lfs diff=lfs merge=lfs -text
66
+ data/potential-test-sets/filtered/desert-lion-upper-bound.csv filter=lfs diff=lfs merge=lfs -text
67
+ data/potential-test-sets/filtered/desert-lion-upper-lower-bound.csv filter=lfs diff=lfs merge=lfs -text
68
+ data/potential-test-sets/filtered/ohio-small-animals-upper-bound.csv filter=lfs diff=lfs merge=lfs -text
69
+ data/potential-test-sets/filtered/ohio-small-animals-upper-lower-bound.csv filter=lfs diff=lfs merge=lfs -text
70
+ data/potential-test-sets/filtered/orinoquia-upper-bound.csv filter=lfs diff=lfs merge=lfs -text
71
+ data/potential-test-sets/filtered/orinoquia-upper-lower-bound.csv filter=lfs diff=lfs merge=lfs -text
72
+ data/potential-test-sets/filtered/island-imbalanced_common.csv filter=lfs diff=lfs merge=lfs -text
73
+ data/potential-test-sets/filtered/island-imbalanced_family.csv filter=lfs diff=lfs merge=lfs -text
74
+ data/potential-test-sets/filtered/island-lower-bound_common.csv filter=lfs diff=lfs merge=lfs -text
75
+ data/potential-test-sets/filtered/island-lower-bound_family.csv filter=lfs diff=lfs merge=lfs -text
76
+ data/potential-test-sets/filtered/ohio-small-animals-upper-bound_checksums.csv filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,5 +1,5 @@
1
  ---
2
- license: pddl
3
  language:
4
  - en
5
  pretty_name: LILA BC Camera Trap Data
@@ -64,6 +64,22 @@ Escape underscores ("_") with a "\". Example: image\_RGB
64
  This 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).
65
  More details on this are below in [Data Instances](#data-instances).
66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  **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:**
68
 
69
  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.
@@ -89,11 +105,44 @@ See the [LILA BC HF Dataset](https://huggingface.co/datasets/society-ethics/lila
89
  lila_image_urls_and_labels.csv
90
  lila_image_urls_and_labels_species.csv # Outdated
91
  lila_image_urls_and_labels_wHumans.csv
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
92
  notebooks/
93
  lilabc_CT.ipynb
94
  lilabc_CT.py
 
 
 
 
95
  ```
96
 
 
 
 
 
 
 
 
 
97
 
98
  ### Data Instances
99
 
@@ -154,12 +203,74 @@ Snapshot Mountain Zebra 7
154
  Snapshot Camdeboo 3
155
  ```
156
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  ### Data Fields
158
  [More Information Needed]
159
  <!--
160
  Describe the types of the data files or the columns in a CSV with metadata.
161
  -->
162
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  ### Data Splits
164
  [More Information Needed]
165
  <!--
@@ -207,15 +318,25 @@ Give your train-test splits for benchmarking
207
  ## Additional Information
208
 
209
  ### Dataset Curators
210
- [More Information Needed]
211
 
212
  ### Licensing Information
213
- [More Information Needed]
214
 
215
- 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)).
216
- 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).
217
 
218
  ### Citation Information
 
 
 
 
 
 
 
 
 
 
 
 
219
  [More Information Needed]
220
  <!--
221
  If you want to include BibTex, replace "<>"s with your info
 
1
  ---
2
+ license: cdla-permissive-1.0
3
  language:
4
  - en
5
  pretty_name: LILA BC Camera Trap Data
 
64
  This 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).
65
  More details on this are below in [Data Instances](#data-instances).
66
 
67
+ 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):
68
+ 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.
69
+ - [Snapshot Safari 2024 Expansion](https://lila.science/datasets/snapshot-safari-2024-expansion/)
70
+ - [Ohio Small Animals](https://lila.science/datasets/ohio-small-animals/)
71
+ - [Desert Lion Conservation Camera Traps](https://lila.science/datasets/desert-lion-conservation-camera-traps/)
72
+ - [Orinoquia Camera Traps](https://lila.science/datasets/orinoquia-camera-traps/)
73
+ - [SWG Camera Traps 2018-2020](https://lila.science/datasets/swg-camera-traps)
74
+ - [Island Conservation Camera Traps](https://lila.science/datasets/island-conservation-camera-traps/)
75
+ - [ENA24-detection](https://lila.science/datasets/ena24detection)
76
+
77
+ There are 2,867,312 images in this subset (once humans and non-creatures are removed).
78
+
79
+ [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.
80
+
81
+ More details on this provided in [Test Data Instances](#test-data-instances), below.
82
+
83
  **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:**
84
 
85
  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.
 
105
  lila_image_urls_and_labels.csv
106
  lila_image_urls_and_labels_species.csv # Outdated
107
  lila_image_urls_and_labels_wHumans.csv
108
+ potential-test-sets/
109
+ lila-taxonomy-mapping_release.csv
110
+ lila_image_urls_and_labels.csv
111
+ filtered/
112
+ ENA24-imbalanced.csv
113
+ ENA24-balanced.csv
114
+ ENA24-balanced-small.csv
115
+ desert-lion-upper-lower-bound.csv
116
+ desert-lion-upper-bound.csv
117
+ desert-lion-balanced.csv
118
+ island-lower-bound_common.csv
119
+ island-lower-bound_family.csv
120
+ island-imbalanced_family.csv
121
+ island-balanced.csv
122
+ island-imbalanced_common.csv
123
+ ohio-small-animals-upper-lower-bound.csv
124
+ ohio-small-animals-upper-bound.csv
125
+ ohio-small-animals-balanced.csv
126
+ orinoquia-upper-lower-bound.csv
127
+ orinoquia-upper-bound.csv
128
+ orinoquia-balanced.csv
129
  notebooks/
130
  lilabc_CT.ipynb
131
  lilabc_CT.py
132
+ lilabc_test-<dataset_name>.ipynb
133
+ lilabc_test-EDA.py
134
+ lilabc_test-filter.ipynb
135
+ lilabc_test-filter.py
136
  ```
137
 
138
+ **Notes:**
139
+ - `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.
140
+ - 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.
141
+ - `upper-bound` are max 10K images per species, with no minimum (this often means the smallest classification class has just 1 image).
142
+ - `upper-lower-bound` CSVs are max 10K images per species and minimum of 10.
143
+ - 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.
144
+ - 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.
145
+
146
 
147
  ### Data Instances
148
 
 
203
  Snapshot Camdeboo 3
204
  ```
205
 
206
+ ### Test Data Instances
207
+
208
+ **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.
209
+ 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).
210
+
211
+ 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).
212
+ This was then subdivided into CSVs for each of the target datasets (`data/potential-test-sets/<dataset_name>_image_urls_and_labels.csv`).
213
+ 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).
214
+
215
+ - [Snapshot Safari 2024 Expansion](https://lila.science/datasets/snapshot-safari-2024-expansion/) -- actually labeled by sequence, so not a good choice for testing
216
+ - [Ohio Small Animals](https://lila.science/datasets/ohio-small-animals/)
217
+ - [Desert Lion Conservation Camera Traps](https://lila.science/datasets/desert-lion-conservation-camera-traps/)
218
+ - [Orinoquia Camera Traps](https://lila.science/datasets/orinoquia-camera-traps/)
219
+ - [SWG Camera Traps 2018-2020](https://lila.science/datasets/swg-camera-traps) -- actually labeled by sequence, so not a good choice for testing
220
+ - [Island Conservation Camera Traps](https://lila.science/datasets/island-conservation-camera-traps/)
221
+ - [ENA24-detection](https://lila.science/datasets/ena24detection)
222
+
223
+ Multi-species counts (full):
224
+ ```
225
+ num_species
226
+ 1.0 2753832
227
+ 2.0 114825
228
+ 3.0 13995
229
+ 4.0 1704
230
+ 5.0 230
231
+ 14.0 42
232
+ ```
233
+ For Image-level labels:
234
+ ```
235
+ num_species
236
+ 1.0 305821
237
+ 2.0 1154
238
+ 3.0 3
239
+ ```
240
+ Looks like we'll have about 306K images across the 5 datasets that have image-level labels.
241
+
242
+
243
+
244
  ### Data Fields
245
  [More Information Needed]
246
  <!--
247
  Describe the types of the data files or the columns in a CSV with metadata.
248
  -->
249
 
250
+ Each of the `<dataset_name>_<type>` CSVs has the following columns.
251
+
252
+ - `dataset_name`: name of the LILA BC dataset
253
+ - `url_gcp`, `url_aws`, `url_azure` are URLs to potentially access the image, we recommend `url_aws`.
254
+ - `image_id`: unique identifier for the image.
255
+ - `sequence_id`: ID of the sequence to which the image belongs.
256
+ - `location_id`: ID of the location at which the camera was placed.
257
+ - `frame_num`: generally 0, 1, or 2, indicates order of image within a sequence.
258
+ - `original_label`: label initially assigned to the image.
259
+ - `scientific_name`: genus species of the animal in the image. For the island CSV, lowest rank taxa available, generally family.
260
+ - `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.
261
+ - `kingdom`: kingdom of the animal in the image.
262
+ - `phylum`: phylum of the animal in the image.
263
+ - `class`: class of the animal in the image.
264
+ - `order`: order of the animal in the image.
265
+ - `family`: family of the animal in the image.
266
+ - `genus`: genus of the animal in the image. About half null in the island CSVs.
267
+ - `species`: species of the animal in the image. Mostly null in the island CSVs.
268
+ - `num_sp_images`: number of images of that species in the dataset.
269
+ 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.
270
+
271
+ Additionally, the `ohio-small-animals` CSVs have a `filename` column defined as `OH_sm_animals_<filename in url_aws>`.
272
+
273
+
274
  ### Data Splits
275
  [More Information Needed]
276
  <!--
 
318
  ## Additional Information
319
 
320
  ### Dataset Curators
321
+ Elizabeth Campolongo
322
 
323
  ### Licensing Information
 
324
 
325
+ This 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).
 
326
 
327
  ### Citation Information
328
+
329
+ For test sets (provided citations on their LILA BC pages are included):
330
+
331
+ - [Ohio Small Animals](https://lila.science/datasets/ohio-small-animals/)
332
+ - 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.
333
+ - [Desert Lion Conservation Camera Traps](https://lila.science/datasets/desert-lion-conservation-camera-traps/)
334
+ - [Orinoquia Camera Traps](https://lila.science/datasets/orinoquia-camera-traps/)
335
+ - 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.
336
+ - [Island Conservation Camera Traps](https://lila.science/datasets/island-conservation-camera-traps/)
337
+ - [ENA24-detection](https://lila.science/datasets/ena24detection)
338
+ - 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))
339
+
340
  [More Information Needed]
341
  <!--
342
  If you want to include BibTex, replace "<>"s with your info
data/potential-test-sets/Desert_Lion_Conservation_Camera_Traps_image_urls_and_labels.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f72c145c8619f23f7b856ea5235d98ce6c5823b9aeff0a7a0561c043684f6f94
3
+ size 71743955
data/potential-test-sets/ENA24_image_urls_and_labels.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/potential-test-sets/Island_Conservation_Camera_Traps_image_urls_and_labels.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:15a2103732b73e74cf77c19bfee1e254b9347396e7073ead1733b6ee5aee3376
3
+ size 42287905
data/potential-test-sets/Ohio_Small_Animals_image_urls_and_labels.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4d1d9d6178296c4cab77872abaf40c3cc995d720f51b506d788a66813330d239
3
+ size 102854067
data/potential-test-sets/Orinoquia_Camera_Traps_image_urls_and_labels.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e41a5b0f2902db6ea442692fe833b5b9c7c4213e0e6afbfc6ff0b17b740cfa81
3
+ size 60893968
data/potential-test-sets/SWG_Camera_Traps_image_urls_and_labels.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c1f66b16dab6712356d3e6d643aa43d0eb256ea1c9f7e18df50c7317da96cc1
3
+ size 851507848
data/potential-test-sets/Snapshot_Safari_2024_Expansion_image_urls_and_labels.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f3d4b274c59cde4672bcf832d1f891b389c7224ccd1a0b531bc94ae6a4fd5ec0
3
+ size 1239337039
data/potential-test-sets/filtered/ENA24-balanced-small.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/potential-test-sets/filtered/ENA24-balanced.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/potential-test-sets/filtered/ENA24-imbalanced.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/potential-test-sets/filtered/desert-lion-balanced.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/potential-test-sets/filtered/desert-lion-upper-bound.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:49584e3f9cd7f9e5ac0458f366779ac2222917a1f86ad671d361018483f2a114
3
+ size 60820880
data/potential-test-sets/filtered/desert-lion-upper-lower-bound.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:be643e7b4eaaf1c46c5d1c55cd62d77184e55b8edab5a4f2e3c7d80782ca273f
3
+ size 56028990
data/potential-test-sets/filtered/island-balanced.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/potential-test-sets/filtered/island-imbalanced_common.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c9f8a03083b8579603ca4bfaaff89b86fb5012ca28531dc27a006ea427e7e1f0
3
+ size 41982648
data/potential-test-sets/filtered/island-imbalanced_family.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a0fb2dfd80d2ef28630ecb276e9f2fb7a207c8cea009a1f4940545c749c0ff17
3
+ size 37897112
data/potential-test-sets/filtered/island-lower-bound_common.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9f94c73b999364cd152907272918e634de714d640b1cb69bb5f24f97eb357617
3
+ size 37903096
data/potential-test-sets/filtered/island-lower-bound_family.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d85c13874b9df3c86369115edf5c4fce3db36684bd47532eda16f84cb9e68a3d
3
+ size 37894148
data/potential-test-sets/filtered/ohio-small-animals-balanced.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/potential-test-sets/filtered/ohio-small-animals-upper-bound.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:84648e040cae2f0aafbf9ce0489a0233301fb2d935ff78089e4779d1628f19e6
3
+ size 74160481
data/potential-test-sets/filtered/ohio-small-animals-upper-bound_checksums.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:72456c743b741aeffd035a294bcb1f406670436a5d2215b43067799737e6cdc0
3
+ size 12737032
data/potential-test-sets/filtered/ohio-small-animals-upper-lower-bound.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7667248d1589e8dca60907590aef8680eae4072dc24e35ba20abe50bae027f54
3
+ size 74136444
data/potential-test-sets/filtered/orinoquia-balanced.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/potential-test-sets/filtered/orinoquia-upper-bound.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4436251d1f180d5cc93d3b02c437da256c3231771d2f1f6f42d0688e5eb4bf35
3
+ size 35138377
data/potential-test-sets/filtered/orinoquia-upper-lower-bound.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:063f0c2f6805690cadfb28d90e50fffaade7b2cc950a30c036ea47a7ec98f730
3
+ size 29981911
data/potential-test-sets/lila-taxonomy-mapping_release.csv ADDED
The diff for this file is too large to render. See raw diff
 
data/potential-test-sets/lila_image_urls_and_labels.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4f741289c6a8f8d2a7eaf766f2eb9cad5fde419007a117bee2c3163c78a8d96e
3
+ size 2372912218
notebooks/lilabc_test-ENA24.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
notebooks/lilabc_test-desert-lion.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
notebooks/lilabc_test-filter.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
notebooks/lilabc_test-filter.py ADDED
@@ -0,0 +1,306 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ---
2
+ # jupyter:
3
+ # jupytext:
4
+ # formats: ipynb,py:percent
5
+ # text_representation:
6
+ # extension: .py
7
+ # format_name: percent
8
+ # format_version: '1.3'
9
+ # jupytext_version: 1.16.0
10
+ # kernelspec:
11
+ # display_name: data-dev
12
+ # language: python
13
+ # name: python3
14
+ # ---
15
+
16
+ # %%
17
+ import pandas as pd
18
+ import seaborn as sns
19
+
20
+ sns.set_style("whitegrid")
21
+
22
+ # %% [markdown]
23
+ # 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)
24
+ #
25
+ # sha256:3fdf87ceea75f8720208a95350c3c70831a6c1c745a92bb68c7f2c3239e4c455
26
+ # size 15931383983
27
+
28
+ # %%
29
+ df = pd.read_csv("../data/potential-test-sets/lila_image_urls_and_labels.csv", low_memory = False)
30
+ df.head()
31
+
32
+ # %%
33
+ df.columns
34
+
35
+ # %%
36
+ df.annotation_level.value_counts()
37
+
38
+ # %% [markdown]
39
+ # 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.
40
+ #
41
+ # We have 3,533,538 images labeled to the image-level.
42
+ #
43
+ # ### Check Dataset Counts
44
+ #
45
+ # 1. Make sure we have all datasets expected. We're specifically interested in:
46
+ # - [Snapshot Safari 2024 Expansion](https://lila.science/datasets/snapshot-safari-2024-expansion/)
47
+ # - [Ohio Small Animals](https://lila.science/datasets/ohio-small-animals/)
48
+ # - [Desert Lion Conservation Camera Traps](https://lila.science/datasets/desert-lion-conservation-camera-traps/)
49
+ # - [Orinoquia Camera Traps](https://lila.science/datasets/orinoquia-camera-traps/)
50
+ # - [SWG Camera Traps 2018-2020](https://lila.science/datasets/swg-camera-traps)
51
+ # - [Island Conservation Camera Traps](https://lila.science/datasets/island-conservation-camera-traps/)
52
+ # - [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`).
53
+ # 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)).
54
+
55
+ # %%
56
+ df.dataset_name.value_counts()
57
+
58
+ # %%
59
+ df.groupby(["dataset_name"]).annotation_level.value_counts()
60
+
61
+ # %% [markdown]
62
+ # It seems snapshot safari exapansion and SWG camera traps are not labeled at the image level, despite the indication in the spreadsheet...
63
+ #
64
+ # The NOAA one isn't here, but that's okay. Let's also take a look at [ENA24](https://lila.science/datasets/ena24detection).
65
+ #
66
+ # 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.
67
+
68
+ # %%
69
+ datasets_of_interest = ["Desert Lion Conservation Camera Traps",
70
+ "Island Conservation Camera Traps",
71
+ "Ohio Small Animals",
72
+ "Orinoquia Camera Traps",
73
+ "SWG Camera Traps",
74
+ "Snapshot Safari 2024 Expansion",
75
+ "ENA24"]
76
+
77
+ # %%
78
+ reduced_df = df.loc[df["dataset_name"].isin(datasets_of_interest)].copy()
79
+ reduced_df.head()
80
+
81
+ # %% [markdown]
82
+ # 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.
83
+
84
+ # %%
85
+ reduced_df.info(show_counts = True)
86
+
87
+ # %% [markdown]
88
+ # Let's remove empty frames to get a better sense of what we have.
89
+
90
+ # %%
91
+ df_cleaned = reduced_df.loc[reduced_df.original_label != "empty"].copy()
92
+ df_cleaned.info(show_counts = True)
93
+
94
+ # %% [markdown]
95
+ # Not all have a scientific name, though those could be the non-taxa labels.
96
+
97
+ # %%
98
+ df_cleaned.loc[df_cleaned["scientific_name"].isna(), "original_label"].value_counts()
99
+
100
+ # %% [markdown]
101
+ # These are clearly also labels to remove, so we can simply reduce down to only those with non-null `scientific_name` values as well.
102
+
103
+ # %%
104
+ df_cleaned = df_cleaned.loc[~df_cleaned["scientific_name"].isna()].copy()
105
+ df_cleaned.info(show_counts=True)
106
+
107
+ # %%
108
+ df_cleaned.nunique()
109
+
110
+ # %% [markdown]
111
+ # 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.
112
+ #
113
+ # 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.
114
+
115
+ # %%
116
+ #double-check for humans
117
+ df_cleaned.loc[df_cleaned.species == "homo sapien"]
118
+
119
+ # %% [markdown]
120
+ # ## Save the Reduced Data (no more "empty" labels)
121
+
122
+ # %%
123
+ df_cleaned.to_csv("../data/potential-test-sets/lila_image_urls_and_labels.csv", index = False)
124
+
125
+ # %%
126
+ print(df_cleaned.phylum.value_counts())
127
+ print()
128
+ print(df_cleaned["class"].value_counts())
129
+
130
+ # %% [markdown]
131
+ # All images are in Animalia, as expected; we have 2 phyla represented and 8 classes:
132
+ # - Predominantly Chordata, and within that phylum, Mammalia is the vast majority, though aves is about 10%.
133
+ # - Note that not every image with a phylum label has a class label.
134
+ # - Insecta, malacostraca, and arachnida are all in the class Arthropoda.
135
+ #
136
+ # ### Label Multi-Species Images
137
+ # We'll go by both the URL and image ID, which do seem to correspond to the same images (for uniqueness).
138
+
139
+ # %%
140
+ df_cleaned["multi_species"] = df_cleaned.duplicated(subset = ["url_aws", "image_id"], keep = False)
141
+
142
+ df_cleaned.loc[df_cleaned["multi_species"]].nunique()
143
+
144
+ # %% [markdown]
145
+ # 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.
146
+
147
+ # %%
148
+ multi_sp_imgs = list(df_cleaned.loc[df_cleaned["multi_species"], "image_id"].unique())
149
+
150
+ # %%
151
+ for img in multi_sp_imgs:
152
+ df_cleaned.loc[df_cleaned["image_id"] == img, "num_species"] = df_cleaned.loc[df_cleaned["image_id"] == img].shape[0]
153
+
154
+ df_cleaned.head()
155
+
156
+ # %% [markdown]
157
+ # Set all the non-multi species images to show 1 in the `num_species` column.
158
+
159
+ # %%
160
+ df_cleaned.loc[df_cleaned["num_species"].isna(), "num_species"] = 1.0
161
+
162
+ df_cleaned.num_species.value_counts()
163
+
164
+ # %%
165
+ df_cleaned.loc[df_cleaned["num_species"] == 14.0].sample(4)
166
+
167
+ # %% [markdown]
168
+ # 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
169
+
170
+ # %%
171
+ print("num homo sapiens: ", df_cleaned.loc[df_cleaned.species == "homo sapiens"].shape)
172
+ df_cleaned.loc[df_cleaned["original_label"] == "human"].shape
173
+
174
+ # %% [markdown]
175
+ # Did any of these factor in to the multi-species counts?
176
+
177
+ # %%
178
+ df_cleaned.loc[(df_cleaned["species"] == "homo sapiens") & (df_cleaned["multi_species"])].shape
179
+
180
+ # %%
181
+ df_cleaned.loc[(df_cleaned["species"] == "homo sapiens") & (df_cleaned["multi_species"])].sample(4)
182
+
183
+ # %% [markdown]
184
+ # Let's fix those counts then.
185
+
186
+ # %%
187
+ human_multi_species = list(df_cleaned.loc[(df_cleaned["species"] == "homo sapiens") & (df_cleaned["multi_species"]), "image_id"].unique())
188
+
189
+ for img in human_multi_species:
190
+ df_cleaned.loc[df_cleaned["image_id"] == img, "num_species"] = df_cleaned.loc[df_cleaned["image_id"] == img, "num_species"] - 1
191
+
192
+ df_cleaned.num_species.value_counts()
193
+
194
+ # %% [markdown]
195
+ # Actually remove human indicators
196
+
197
+ # %%
198
+ df_cleaned = df_cleaned.loc[df_cleaned["species"] != "homo sapiens"].copy()
199
+
200
+ # %% [markdown]
201
+ # Need to remove the images that have humans and other species too.
202
+
203
+ # %%
204
+ df_cleaned = df_cleaned.loc[~df_cleaned["image_id"].isin(human_multi_species)].copy()
205
+
206
+ # %% [markdown]
207
+ # #### Save this to CSV now we got those counts
208
+
209
+ # %%
210
+ df_cleaned.to_csv("../data/potential-test-sets/lila_image_urls_and_labels.csv", index = False)
211
+
212
+ # %% [markdown]
213
+ # ### Generate individual CSVs for the datasets
214
+
215
+ # %%
216
+ for dataset in datasets_of_interest:
217
+ df_cleaned.loc[df_cleaned["dataset_name"] == dataset].to_csv(dataset+"_image_urls_and_labels.csv", index = False)
218
+
219
+ # Manually moved these to the data/potential-test-sets/ directory and renamed to not have spaces in the filenames
220
+ # (replaced spaces with underscores)
221
+
222
+ # %% [markdown]
223
+ # Get some basic stats
224
+
225
+ # %%
226
+ print(f"there are {df_cleaned.shape[0]} images")
227
+ print(f"we have {df_cleaned['scientific_name'].nunique()} unique scientific names")
228
+ print(f"when we filter for image-level labels, we have {df_cleaned.loc[df_cleaned['annotation_level'] == 'image', 'scientific_name'].nunique()} scientific names")
229
+
230
+ # %%
231
+ df_cleaned.loc[df_cleaned['annotation_level'] == 'image', 'num_species'].value_counts()
232
+
233
+ # %% [markdown]
234
+ # 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.
235
+
236
+ # %%
237
+ df_cleaned.annotation_level.value_counts()
238
+
239
+ # %% [markdown]
240
+ # 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.
241
+
242
+ # %% [markdown]
243
+ # ### Taxonomic String Exploration
244
+
245
+ # %%
246
+ lin_taxa = ['kingdom', 'phylum', 'class', 'order', 'family', 'genus', 'species']
247
+
248
+ # %% [markdown]
249
+ # #### How many have all 7 Linnean ranks?
250
+
251
+ # %%
252
+ df_all_taxa = df_cleaned.dropna(subset = lin_taxa)
253
+ df_all_taxa[lin_taxa].info(show_counts = True)
254
+
255
+ # %%
256
+ df_all_taxa_img = df_cleaned.loc[df_cleaned["annotation_level"] == "image"].dropna(subset = lin_taxa)
257
+ df_all_taxa_img[lin_taxa].info(show_counts = True)
258
+
259
+ # %%
260
+ df_cleaned.loc[df_cleaned["annotation_level"] == "image"].shape
261
+
262
+ # %% [markdown]
263
+ # That's not too bad, considering some are definitely just common names or classes: 2,187,756 out of 2,867,312.
264
+ #
265
+ # 249,847 when we drop to just image-level annotations (out of 306,978).
266
+ #
267
+ #
268
+ # Now how many different 7-tuples are there?
269
+ #
270
+ # #### How many unique 7-tuples?
271
+
272
+ # %%
273
+ #number of unique 7-tuples in full dataset
274
+ df_cleaned['lin_duplicate'] = df_cleaned.duplicated(subset = lin_taxa, keep = 'first')
275
+ df_unique_lin_taxa = df_cleaned.loc[~df_cleaned['lin_duplicate']].copy()
276
+ print(f"unique taxa in all: {df_unique_lin_taxa.shape[0]}")
277
+ print(f"unique taxa in image-level labeled: {df_unique_lin_taxa.loc[df_unique_lin_taxa["annotation_level"] == "image"].shape[0]}")
278
+
279
+ # %% [markdown]
280
+ # Pretty much aligns with the scientific name counts.
281
+
282
+ # %%
283
+ df_unique_lin_taxa.scientific_name.nunique()
284
+
285
+ # %%
286
+ df_unique_lin_taxa.loc[(df_unique_lin_taxa["scientific_name"].isna()) | (df_unique_lin_taxa["common_name"].isna())]
287
+
288
+ # %% [markdown]
289
+ # Let's check out our top ten labels, scientific names, and common names. Then we'll save this cleaned metadata file.
290
+
291
+ # %%
292
+ df_cleaned["original_label"].value_counts()[:10]
293
+
294
+ # %%
295
+ df_cleaned["scientific_name"].value_counts()[:10]
296
+
297
+ # %%
298
+ df_cleaned["common_name"].value_counts()[:10]
299
+
300
+ # %%
301
+ sns.histplot(df_cleaned, y = 'class')
302
+
303
+ # %%
304
+ sns.histplot(df_cleaned.loc[df_cleaned["class"].isin(["aves", "mammalia", "reptilia"])], y = 'order')
305
+
306
+ # %%
notebooks/lilabc_test-island.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
notebooks/lilabc_test-ohio-small-animal.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
notebooks/lilabc_test-orinoquia.ipynb ADDED
The diff for this file is too large to render. See raw diff