
The dataset viewer is not available for this split.
Error code: StreamingRowsError Exception: CastError Message: Couldn't cast image: string label: string to {'image': Image(mode=None, decode=True, id=None)} because column names don't match Traceback: Traceback (most recent call last): File "/src/services/worker/src/worker/utils.py", line 99, in get_rows_or_raise return get_rows( File "/src/libs/libcommon/src/libcommon/utils.py", line 272, in decorator return func(*args, **kwargs) File "/src/services/worker/src/worker/utils.py", line 77, in get_rows rows_plus_one = list(itertools.islice(ds, rows_max_number + 1)) File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/iterable_dataset.py", line 2270, in __iter__ for key, example in ex_iterable: File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/iterable_dataset.py", line 1856, in __iter__ for key, pa_table in self._iter_arrow(): File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/iterable_dataset.py", line 1888, in _iter_arrow pa_table = cast_table_to_features(pa_table, self.features) File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2215, in cast_table_to_features raise CastError( datasets.table.CastError: Couldn't cast image: string label: string to {'image': Image(mode=None, decode=True, id=None)} because column names don't match
Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
BIOSCAN-5M
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:
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:
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:
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:
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.

Dataset Access
To clone this dataset repository, use the following command:
GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/datasets/bioscan-ml/BIOSCAN-5M
๐ฆ Resources and Access
- ๐ Paper: arXiv
- ๐ Website: BIOSCAN-5M Project Page
- ๐ป GitHub: bioscan-ml/BIOSCAN-5M
- ๐ Downloads:
- Downloads last month
- 361
Models trained or fine-tuned on bioscan-ml/BIOSCAN-5M
