BIOSCAN-5M / README.md
Gharaee's picture
Update README.md
ec443a0 verified
---
license: cc-by-3.0
language:
- en
size_categories:
- 1M<n<10M
pretty_name: BIOSCAN-5M
tags:
- Multimodal_dataset
- Large_dcale_dataset
- Image
- DNA_barcode
- Taxonomy
- Biodiversity
- LLMs
- BERT
- Clustering
- Multimodal_retrieval_learning
- Zero_shot_transfer_learning
- Geo_location
- Specimen_size
- Insect
- Species
maintainers:
- https://huggingface.co/Gharaee
author:
name: Zahra Gharaee
github: https://github.com/zahrag
hf: https://huggingface.co/Gharaee
dataset_loader_script: dataset.py
dataset_split_names:
- pretarin
- train
- validation
- test
- val_unseen
- test_unseen
- key_unseen
- other_heldout
---
[![Author: zahrag](https://img.shields.io/badge/author-zahrag-blue)](https://huggingface.co/Gharaee)
# BIOSCAN-5M
![image/png](https://cdn-uploads.huggingface.co/production/uploads/64cac7e17221ef3c7e2eed1f/ZgP3fd2Z9eVgucsZHYYvA.png)
## Overview
As part of an ongoing worldwide effort to comprehend and monitor insect biodiversity, we present the BIOSCAN-5M Insect dataset to the machine learning community. BIOSCAN-5M is a comprehensive dataset containing multi-modal information for over 5 million insect specimens,
and it significantly expands existing image-based biological datasets by including taxonomic labels, raw nucleotide barcode sequences, assigned barcode index numbers, geographical information, and specimen size.
### Citation
If you make use of the BIOSCAN-5M dataset and/or its code repository, please cite the following paper:
```
cite as:
@inproceedings{gharaee2024bioscan5m,
title={{BIOSCAN-5M}: A Multimodal Dataset for Insect Biodiversity},
booktitle={Advances in Neural Information Processing Systems},
author={Zahra Gharaee and Scott C. Lowe and ZeMing Gong and Pablo Millan Arias
and Nicholas Pellegrino and Austin T. Wang and Joakim Bruslund Haurum
and Iuliia Zarubiieva and Lila Kari and Dirk Steinke and Graham W. Taylor
and Paul Fieguth and Angel X. Chang
},
editor={A. Globerson and L. Mackey and D. Belgrave and A. Fan and U. Paquet and J. Tomczak and C. Zhang},
pages={36285--36313},
publisher={Curran Associates, Inc.},
year={2024},
volume={37},
url={https://proceedings.neurips.cc/paper_files/paper/2024/file/3fdbb472813041c9ecef04c20c2b1e5a-Paper-Datasets_and_Benchmarks_Track.pdf},
}
```
## Large-Scale Foundation Model Training for Biodiversity Research
### Dataset partitions
| Partition | Example Splits | Description |
|---------------------|---------------------------------------|---------------------------------------------------------------------------|
| **Closed-world** | train, val, test | Samples with known species names for supervised classification. |
| **Open-world** | key_unseen, val_unseen, test_unseen | Placeholder species names but known genera, enabling generalization to unseen species. |
| **Novelty Detection**| other_heldout | Unknown species and genus, suitable for open-set detection. |
| **Pretraining** | pretrain | Unlabeled data for self-/semi-supervised learning at scale. |
### Supported tasks
| Task | Description |
|----------------------------------------|-----------------------------------------------------------------------------|
| DNA-based Taxonomic Classification | Predict taxonomic labels from raw DNA barcode sequences. |
| Zero-Shot Transfer Learning | Evaluate whether unlabeled models can semantically cluster data—across modalities like image and DNA—using learned representations. |
| Multimodal Retrieval Learning | Retrieve matching specimens across modalities (e.g., image ↔ DNA ↔ text) via shared embeddings. |
### Dataset features via metadata fields
| **Field Group** | **Field(s)** | **Description** |
|---------------------|------------------------------------------------------------------------------|---------------------------------------------------------------|
| **Image** | `image` | RGB JPEG image of an individual insect specimen. |
| **Indexing** | `processid`, `sampleid` | Unique identifiers from BOLD and the collector. |
| **Taxonomy** | `phylum`, `class`, `order`, `family`, `subfamily`, `genus`, `species` | Hierarchical taxonomic classification. |
| **Genetics** | `dna_bin`, `dna_barcode` | Barcode Index Number and DNA sequence. |
| **Geography** | `country`, `province_state`, `coord-lat`, `coord-lon` | Collection location and geographic coordinates. |
| **Specimen Size** | `image_measurement_value`, `area_fraction`, `scale_factor` | Image-based size measures and normalization factors. |
| **Splits & Storage**| `split`, `chunk` | Data partition (e.g., train/test) and storage subdirectory. |
## Usage
First, download the `dataset.py` script to your project directory by running the following command:
```python
wget -P /path/to/your/project_directory https://huggingface.co/datasets/bioscan-ml/BIOSCAN-5M/resolve/main/dataset.py
```
Once you've downloaded the script, you can use the `datasets` library to load the dataset. For example:
```python
from datasets import load_dataset
ds = load_dataset("dataset.py", name="cropped_256_eval", split="validation", trust_remote_code=True)
```
> **ℹ️ Note:** The CSV metadata and image package associated with the selected configuration will be automatically downloaded and extracted to `~/.cache/huggingface/datasets/downloads/extracted/` .
### 📑 Configurations
Each configuration loads specimen images along with associated metadata fields:
| **`name`** | **Available `split` values** |
|--------------------------------------------- |------------------------------------------------------------------- |
| `cropped_256`, `original_256` | `pretrain`, `train`, `validation`, `test`, `val_unseen`, `test_unseen`, `key_unseen`, `other_heldout` |
| `cropped_256_pretrain`, `original_256_pretrain` | `pretrain` |
| `cropped_256_train`, `original_256_train` | `train` |
| `cropped_256_eval`, `original_256_eval` | `validation`, `test`, `val_unseen`, `test_unseen`, `key_unseen`, `other_heldout` |
> **ℹ️ Note:** If you do not specify the `split` when loading the dataset, all available splits will be loaded as a dictionary.
## Sample Usage
First, download the `usage_demo_bioscan5m.py` script to your project directory by running the following command:
```python
wget -P /path/to/your/project_directory https://huggingface.co/datasets/bioscan-ml/BIOSCAN-5M/resolve/main/usage_demo_bioscan5m.py
```
This script demonstrates how to load and visualize samples from the BIOSCAN-5M dataset.
To run the script, execute:
```bash
python usage_demo_bioscan5m.py
```
This will display 10 dataset samples, each showing the organism image on the right, and the corresponding metadata fields on the left, including taxonomic, geographic, genetic, and size-related information.
<img src="https://cdn-uploads.huggingface.co/production/uploads/64cac7e17221ef3c7e2eed1f/qlC1wtjfa_CqOzD2r07Kr.png" alt="image" width="1000"/>
## Dataset Access
To clone this dataset repository, use the following command:
```bash
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/datasets/bioscan-ml/BIOSCAN-5M
```
### 📦 Resources and Access
- **📄 Paper**: [arXiv](https://arxiv.org/abs/2406.12723)
- **🌐 Website**: [BIOSCAN-5M Project Page](https://biodiversitygenomics.net/5M-insects/)
- **💻 GitHub**: [bioscan-ml/BIOSCAN-5M](https://github.com/bioscan-ml/BIOSCAN-5M)
- **📁 Downloads**:
- [Google Drive](https://drive.google.com/drive/u/1/folders/1Jc57eKkeiYrnUBc9WlIp-ZS_L1bVlT-0)
- [Zenodo](https://zenodo.org/records/11973457)
- [Kaggle](https://www.kaggle.com/datasets/zahragharaee/bioscan-5m/data)
![image/png](https://cdn-uploads.huggingface.co/production/uploads/64cac7e17221ef3c7e2eed1f/DRj7GKEvV4ANbUvGSQvKA.png)