egrace479's picture
Add mimic groups (#6)
3264ec4 verified
---
task_categories:
- image-classification
tags:
- butterfly
- heliconius
- dorsal
- ventral
- RGB
- full body
- separated wings
- mimicry
- CV
- erato
- melpomene
- hybrids
- cross types
- wild
- lab-bred
- mimic groups
pretty_name: Heliconius Collection (Cambridge Butterfly)
size_categories:
- 10K<n<100K
language:
- en
configs:
- config_name: full_master
data_files:
- split: train
path: img_master.csv
- config_name: heliconius
data_files:
- split: train
path: Heliconius_img_master.csv
- config_name: dorsal
data_files:
- split: train
path: dorsal_img_master.csv
---
# Dataset Card for Heliconius Collection (Cambridge Butterfly)
## Dataset Description
<!--
- **Homepage:**
- **Repository:**
- **Paper:**
- **Leaderboard:**
- **Point of Contact:**
-->
### Dataset Summary
Subset of the collection records from Chris Jiggins' research group at the University of Cambridge, collection covers nearly 20 years of field studies.
This subset contains approximately 36,189 RGB images of 11,962 specimens (29,134 images of 10,086 specimens across all Heliconius). Many records have both images and locality data.
Most images were photographed with a DSLR camera with a 100 mm macro-lens in standardized conditions.
More information can be found at the individual Zenodo record pages.
Images and full records with data are stored in the [EarthCape database](https://heliconius.ecdb.io/) and on [Zenodo](https://zenodo.org/communities/butterfly?q=&l=list&p=1&s=10&sort=newest) (across 29 records from the Butterfly Genetics Group).
Please note that the [EarthCape Database](https://heliconius.ecdb.io/Occurrence_ListView) is under continuous development as more specimens are classified, photographed, sequenced, etc. by the Butterfly Genetics Group.
Both dorsal and ventral images available. Contains primarily separated wings, with some whole butterfly images. There is variation in image content (whitestandard, background color, etc. based on the needs of the project).
Additionally, we added image-level Heliconius subspecies mimic group information to the entries. The two subspecies in this dataset that exhibit polymorphic mimicry (_Heliconius doris ssp. doris_ and _Heliconius melpomene ssp. martinae_) were labeled based on the specimen images (all mimicry groups are accurate for the images).
<!---
This dataset card aims to be a base template for new datasets. It has been generated using [this raw template](https://github.com/huggingface/huggingface_hub/blob/main/src/huggingface_hub/templates/datasetcard_template.md?plain=1).
--->
<!--
### Supported Tasks and Leaderboards
[More Information Needed] -->
### Languages
English, Latin
## Dataset Structure
* **img_master.csv:** Information for the approximately 36,000 unprocessed image files included in the Jiggins Heliconius Collection. Image types are `jpg`, `raw` (.CR2) and `tif`. `genus`, `species`, and `subspecies` are included columns.
* **dorsal_img_master.csv:** Subset of 17,748 images from `img_master.csv` with a dorsal view of the butterflies (note that some have both dorsal and ventral). This subset includes 11,746 unique specimens. Image types and columns are the same as for the Master file.
* **Heliconius_img_master.csv:** The 29,134-image subset of all Heliconius images from `img_master.csv`. This subset includes 10,086 unique specimens. Image types and columns are the same as for the Master file.
**Notes:**
- The notebooks that generated these files and stats are included in the `notebooks` folder, their only requirement is `pandas`.
- The [original Jiggins Zenodo Master file](https://huggingface.co/datasets/imageomics/Heliconius-Collection_Cambridge-Butterfly/blob/main/metadata/Jiggins_Zenodo_Master.csv) was compiled from the CSVs provided with the included Zenodo records from the Butterfly Genetics Group. Christopher Lawrence selected which of these provided columns to include. Further processing and standardization (all documented in the Jupyter Notebooks) was performed by Elizabeth Campolongo.
- Taxonomic information for records [5526257](https://zenodo.org/record/5526257), [2554218](https://zenodo.org/record/2554218), and [2555086](https://zenodo.org/record/2555086) was recovered from information on their Zenodo pages, as the provided CSVs did not contain that information.
- Be advised that there may be overlap between images in [record 2548678](https://zenodo.org/records/2548678) and [record 3082688](https://zenodo.org/records/3082688).
- The `scripts` folder has a download and checksum script, their only requirement is `pandas`.
- Images are downloaded to the provided images directory with subfolders labeled by the `Taxonomic_Name`, with filenames `<X>_<Image_name>`.
- The checksum script is called by `download_jiggins_subset.py` to generate an MD5 for all downloaded images and creates a CSV with `filepath`, `filename`, and `md5` columns in the same folder as the source CSV (named `<source CSV>_checksums.csv`). This helps to ensure FAIR and Reproducible results, though this will _**not**_ distinguish between RAW and JPG versions of the same image.
- A log of the download is also generated in the same folder as the source CSV (named `<source CSV>_log.json`).
- `metadata/Missing_taxa_Jiggins_Zenodo_Master.csv` contains a record of the images that did not have easily reconcilable taxonomic information (see `notebooks/Data-gen-0-3.ipynb` for more information on this data). There are 1,630 such images distributed across 18 records.
- `metadata/Missing_taxa_download.csv` contains the 22 entries that had `Unknown` or `Stratiomyidae` (not a butterfly) as their `Taxonomic_Name`. Their specimen IDs did not appear elsewhere in the record, so this information was not easily reconcilable (see `notebooks/Data-gen-1-2.ipynb` for more information).
### Data Instances
`Heliconius_img_master.csv` contains multiple species of Heliconius (including erato and melpomene), most are labeled down to the subspecies level. The `img_master.csv` also contains species from other genera, with just over half labeled to the subspecies level (these are predominantly Heliconius subspecies).
Detached wings in four quadrants (generally). Many include a label indicating the specimen ID (`CAMID`). There is variation in formatting both across and within records, but overall setup is relatively consistent.
Some subspecies may be photographed differently, needs segmentation preprocessing.
* **Type:** RAW (`.CR2`), JPG, and TIFF (very few)
* **Size (x pixels by y pixels):** Unknown yet
* **Background (color or none):** multiple (needs to be normalized, often grey or lime green)
* **Fit in frame:** varies
* **Ruler or Scale:** Some with Ruler
* **Color (ColorChecker, white-balance, None):** some with ColorChecker, many with white reflectance standard in the bottom right corner.
#### Preprocessing steps (to be done):
1. Hybrid separation - some images labeled as _H. erato_ and _H. melpomene_ without subspecies names are hybrids and need to be determined what subspecies they are.
2. Label correction - along with step 1.
3. Removal of subspecies with no mimic pairs.
4. Segmentation of four wings from images so we can focus on forewings vs hindwings: [WingSeg](https://github.com/agporto/WingSeg).
Current preprocessing steps: [WingSeg](https://github.com/agporto/WingSeg) on the [Meier subset](https://huggingface.co/datasets/imageomics/Meier-Subset-Jiggins/).
### Data Fields
CSV Columns are as follows:
- `CAMID`: Unique identifier for each specimen that was photographed. Each `CAMID` corresponds to multiple images (based on factors such as `View` and `file_type`).
- `X`: Unique identifier for each line in the master CSV.
- `Image_name`: Filename of image (unique, often `CAM<CAMID>_<v or d>`).
- `View`: View of the butterfly in the image: `dorsal`, `ventral`, `forewing dorsal`, `hindwing dorsal`, `forewing ventral`, `hindwing ventral`, or `dorsal and ventral`.
- `zenodo_name`: Name of the CSV file with metadata from the associated Zenodo record used to populate the information about this image.
- `zenodo_link`: URL for the Zenodo record of the image.
- `Sequence`: Mostly numeric IDs, not unique, please see the associated Zenodo record for more information on the meaning of these designations.
- `Taxonomic_Name`: Indication of the Genus, species, and possibly, subspecies, of the specimen. For Cross Types, the hybrid names are reduced to just the two subspecies (from the `Cross_Type` column) and non-specified crosses are labeled `<Genus> <species> cross hybrid`.
- `Locality`: Likely location of specimen collection, varying levels of specificity. Please see the associated Zenodo record for more information on the meaning of these designations.
- `Sample_accession`: Some type of ID, not unique, please see the associated Zenodo record for more information on the meaning of these designations.
- `Collected_by`: Abbreviations (likely for those collecting the specimen), please see the associated Zenodo record for more information on the meaning of these designations.
- `Other_ID`: Mostly numeric IDs, not unique, please see the associated Zenodo record for more information on the meaning of these designations.
- `Date`: Please see the associated Zenodo record for more information on the meaning of these designations.
- `Dataset`: Overall collection the images belong to: `Heliconiine Butterfly Collection Records from University of Cambridge` (largely, but not entirely Heliconius), `Patricio Salazar`, `Nadeau Sheffield`, `Bogota Collection (Camilo Salazar)`, `Cambridge Collection`, `Mallet`, `Merril_Gamboa`, `STRI Collection (Owen)`. Please see the associated Zenodo record for more information on the meaning of these designations.
- `Store`: Storage location for specimen (`Box ###`).
- `Brood`: Likely indicator of batch of butterflies. Please see the associated Zenodo record for more information on the meaning of these designations.
- `Death_Date`: Date of specimen death. Only noted for 269 images.
- `Cross_Type`: Laboratory cross breeding information. There is a mix of F1 (subspecies x subspecies), F2 (F1 x F1), and backcross (F1 x subspecies) hybrids; these are all crosses of _Heliconius erato_ and _Heliconius melpomene_ subspecies. Generally, the order of the subspecies listed in the cross corresponds to the sexes of the parents (Maternal x Paternal). There are approximately 4,400 such images; on average, there are both raw and jpg images of the specimens for each view, so this covers 820 unique specimens.
- `Stage`: Life stage of the specimen. Only 6 images (3 specimens) have a non-null value for this feature, and they are all labeled as `Adult`.
- `Sex`: Sex of the specimen: `Male`, `Female`, or `Unknown`; there are also null values.
- `Unit_Type`: Type of the specimen: `wild`, `reared`, `Mutant`, `Wild`, `e11`, or `e12`. Please see the associated Zenodo record for more information on the meaning of these designations.
- `file_type`: Image type: `jpg`, `raw` (.CR2), or `tif`.
- `record_number`: The number associated with the Zenodo record that the image came from.
- `species`: Species of the specimen. There are 242 species represented in the full collection, 36 of these are species of Heliconius. Note that 25 of these are `<Genus> sp.` indicating that they are a species of the designated genus, but have not been classified at the species level, this includes `Heliconius sp.` and `Heliconius hybrid` designations.
- `subspecies`: Subspecies of the specimen (where available, mostly labeled for Heliconius). There are 155 subspecies represented in the full collection, 110 of which are Heliconius subspecies.
- `genus`: Genus of the specimen. There are 92 unique genera represented in the full collection.
- `file_url`: URL to download image from Zenodo: `zenodo_link + "/files/" + Image_name`. Allows for sample image display in [data dashboard](https://huggingface.co/spaces/imageomics/dashboard-prototype).
- `hybrid_stat`: Hybrid status of the sample: `hybrid`, `non-hybrid`, or `None`. Hybrids are determined by an ` x ` or `hybrid` in the `Taxonomic_Name` column, all other images classified to the _subspecies_ level are labeled as `non-hybrid`, and the parent species of the one species-level hybrid is labeled as `non-hybrid` (only one of them is present in the dataset).
- `filename`: Unique filename assigned to image at download (`<X>_<Image_name>.<jpg/tif/CR2>`) using `scripts/download_jiggins_subset.py`.
- `filepath`: Filepath of the downloaded image (`<image_folder>/<Taxonomic_Name>/<filename>`) using `scripts/download_jiggins_subset.py`.
- `md5`: MD5 of the downloaded image. This was used as the measure of uniqueness (at the pixel level) to address duplication of images across Zenodo records.
- `mimic_group`: Mimicry group of the subspecies; only included for Heliconius subspecies. Polymorphic subspecies (_Heliconius doris ssp. doris_ and _Heliconius melpomene ssp. martinae_) are labeled based on the specimen images.
**Note:**
- `dorsal_img_master.csv` also has a column `CAM_dupe` indicating whether the `CAMID` has multiple images of the same file type within this subset. Most (11,446) specimens have only one dorsal image per file type.
- `CAMID`s are necessarily duplicated for the images that are of just a dorsal forewing or hindwing, so we label those as `single_wing`. There are one RAW and one JPG image for each single wing. None of these are Heliconius butterflies.
- Instances of both dorsal and ventral wings in the same image are labeled `both-wings`; there are 18 such images, all of Heliconius butterflies.
- There are multiple JPG images with the same `CAMID`. Note that this does not necessarily mean these are duplicates of the same images; check the views to confirm. There are also JPG copies provided alongside RAW images. Generally, RAW images will be unique up to `View`, as there is only one CAMID with two RAW images that aren't of just a single wing.
<!--
### Data Splits
[More Information Needed]
-->
## Dataset Creation
### Curation Rationale
The Butterfly Genetics Group has a large collection of butterfly images distributed across 31 Zenodo records. They do not all have the same information, and it is sometimes only provided in the record, but not the metadata. With this collection, we combine the provided information (metadata) into a shared format that is easily ingested into ML pipelines. We also add some other labels of interest (based on identification determined by the Butterfly Genetics Group), and endeavor to remove duplication, noting potential points of duplication and providing some assessment tools to help prevent data leakage. This de-duplication effort reduced the overall dataset to covering only 29 of these records, and it is documented in the `deduplication_process` directory.
We added image-level Heliconius subspecies mimic group information to further our ability to study mimicry with ML; they also can help provide context or another layer of analysis for mistaken mimic predictions.
Additionally, these datasets are prepared in a format that allows for easy integration with the Imageomics Institute's [Data Dashboard](https://huggingface.co/spaces/imageomics/dashboard-prototype) for distribution statistics and easy sampling of images by taxonomic information and view.
### Source Data
These images are a subset of the [Butterfly Genetics Group's Cambridge butterfly collection](https://zenodo.org/communities/butterfly?q=&f=subject%3ACambridge&l=list&p=1&s=10&sort=newest). This collection of butterfly images comes from the research group of Chris Jiggins at the University of Cambridge derived from almost 20 years of field studies.
Data is pulled from the Zenodo Records in [`licenses.json`](https://huggingface.co/datasets/imageomics/Heliconius-Collection_Cambridge-Butterfly/blob/main/metadata/licenses.json). This file also contains full citation information for all records.
The [original Master file](https://huggingface.co/datasets/imageomics/Heliconius-Collection_Cambridge-Butterfly/blob/main/metadata/Jiggins_Zenodo_Master.csv), created by Christopher Lawrence, was fed into notebook Data-gen-0-1, and further processed in Data-gen-0-2 and Data-gen-0-3. The next data generation step (deduplication by MD5) involved downloading all images in `metadata/Jiggins_Zenodo_Img_Master_3477891Patch.csv` (created in Data-gen-1-1). MD5s of all downloaded images were taken and the results were explored in the EDA-DL series of notebooks; information and conclusions from this EDA are documented in [`README-supplemental`](https://huggingface.co/datasets/imageomics/Heliconius-Collection_Cambridge-Butterfly/blob/main/README-supplemental.md). The outline described there was then implemented in the [Data-gen-1-2 notebook](https://huggingface.co/datasets/imageomics/Heliconius-Collection_Cambridge-Butterfly/blob/main/notebooks/Data-gen-1-2.ipynb), regenerating all current datasets. This notebook also has another round of taxonomic standardization so that all entries labeled only to the genus level are labeled as `<Genus> sp.` in both `Taxonomic_Name` and `species` columns, 4 entries with a non-butterfly genus name were noted and removed, as were 18 entries with `Unknown` as their taxonomic label.
#### Initial Data Collection and Annotation
These images are of a mix of wild-caught and lab-bred butterflies, classified by the Butterfly Genetics Group.
Mimicry group labels were provided by [Neil Rosser](https://scholar.google.com/citations?user=bKyzoi0AAAAJ&hl=en) and added programmatically in [`notebooks/Data-gen-1-3.ipynb`](https://huggingface.co/datasets/imageomics/Heliconius-Collection_Cambridge-Butterfly/blob/main/notebooks/Data-gen-1-3.ipynb). The two Heliconius subspecies in this dataset that exhibit polymorphic mimicry (_Heliconius doris ssp. doris_ and _Heliconius melpomene ssp. martinae_) were given the `mimic_group` label for those particular specimens.
### Personal and Sensitive Information
None
## Considerations for Using the Data
### Discussion of Biases and Other Known Limitations
- This dataset is imbalanced. Even among the Heliconius subset, some subspecies are more heavily represented than others.
- Not all images are labeled with the same detail. There are a mix of valid subspecies and hybrids that are labeled as such, but there are also images of butterflies classified only to the genus or species level, for which such a designation may not be clearly made. These images are limited to classification tasks only down to the level of their label. There are also instances of "_Heliconius <species> hybrid_", where the parent subspecies are not indicated because it was labeled only as a hybrid of that species.
- All entries labeled only to the genus level can be recognized by ` sp.` following the genus in the `Taxonomic_Name` and `species` columns or are labeled as `Heliconius hybrid` in those columns.
- There may be overlap between images in [record 2548678](https://zenodo.org/records/2548678) and [record 3082688](https://zenodo.org/records/3082688).
- There are multiple images of the same specimen for many specimens; sometimes this is due to different views (eg., dorsal or ventral side), sometimes it is due to JPG copies of the RAW photos, though it seems it is also sometimes that new photos were taken of the same specimen at a different times.
- The master files contain only images that were determined to be unique (at the pixel level) through MD5 checksum. This does _**not**_ guarantee that there are not images that are cropped copies of other photos. For instance, [record 2553977](https://zenodo.org/records/2553977) has a number of images with `_cut_` in their name, some of which are close-up crops of the butterfly wings (though not all, some are just close-ups of the full butterfly).
Please see [`README-supplemental.md`](https://huggingface.co/datasets/imageomics/Heliconius-Collection_Cambridge-Butterfly/blob/main/README-supplemental.md) for more details on the deduplication process and recommendations on how to split this data effectively without data leakage.
## Additional Information
### Dataset Curators
**Original Images:**
* Chris Jiggins (University of Cambridge) - ORCID: 0000-0002-7809-062X
* Gabriela Montejo-Kovacevich (University of Cambridge)
* Ian Warren (University of Cambridge)
* Butterfly Genetics Group (University of Cambridge)
**This Collection:**
* Christopher Lawrence (Princeton University) - ORCID: 0000-0002-3846-5968
* Elizabeth G. Campolongo (Imageomics Institute, The Ohio State University) - ORCID: 0000-0003-0846-2413
* Neil Rosser (Harvard University) - ORCID: 0000-0001-7796-2548
### Licensing Information
The data (images and text) are all licensed under [Creative Commons Attribution 4.0 International](https://creativecommons.org/licenses/by/4.0/). Each image and text in this dataset is provided under the least restrictive terms allowed by its licensing requirements as provided to us (i.e, we impose no additional restrictions past those specified by this license on the original source files).
Images can be matched to their source record through the `zenodo_link` or `record_number` column in the Master CSVs to the `url` or `record_number` in the [`licenses.json`](https://huggingface.co/datasets/imageomics/Heliconius-Collection_Cambridge-Butterfly/blob/main/metadata/licenses.json) file, respectively.
### Citation Information
Christopher Lawrence, Elizabeth G. Campolongo, and Neil Rosser. (2024). Heliconius Collection (Cambridge Butterfly). Hugging Face. https://huggingface.co/datasets/imageomics/Heliconius-Collection_Cambridge-Butterfly. [Add updated DOI for mimic group update].
If you use this compilation, please also cite the original datasets compiled by the Butterfly Genetics Group at University of Cambridge (bibtex citations for all 29 included Zenodo records are in [`jiggins.bib`](https://huggingface.co/datasets/imageomics/Heliconius-Collection_Cambridge-Butterfly/blob/main/metadata/jiggins.bib)) as well as this curated subset.
### Contributions
The [Imageomics Institute](https://imageomics.org) is funded by the US National Science Foundation's Harnessing the Data Revolution (HDR) program under [Award #2118240](https://www.nsf.gov/awardsearch/showAward?AWD_ID=2118240) (Imageomics: A New Frontier of Biological Information Powered by Knowledge-Guided Machine Learning). Any opinions, findings and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.