Text Embeddings
Be sure to select the proper text embedding files for the model and dataset versions:
BioCLIP 2
Files
txt_emb_bioclip-2.json
txt_emb_bioclip-2.npy
txt_emb_species.json and txt_emb_species.npy: duplicates of txt_emb_bioclip-2 files to support pybioclip backwards compatibility
Generation
BioCLIP 2 text embeddings of TreeOfLife-200M were generated with make_txt_embedding.py, using the txt_emb_bioclip-2.json to provide the 7-rank Linnean taxonomic names. These text embeddings match to the BioCLIP 2 training dataset, specified by the catalog parquet from Revision a8f38b4. Note that txt_emb_species.npy and txt_emb_species.json are duplicates of the BioCLIP 2 files, included here to maintain pybioclip functionality for versions 2.1.x and earlier.
BioCLIP 2.5 Huge
Files
txt_emb_bioclip-2.5-vith14.json
txt_emb_bioclip-2.5-vith14.npy
Generation
The BioCLIP 2.5 Huge text embeddings of TreeOfLife-200M were also generated with make_txt_embedding.py, but using the txt_emb_bioclip-2.5-vith14.json to provide the 7-rank Linnean taxonomic names. These text embeddings match to the BioCLIP 2.5 Huge training dataset, specified by the catalog parquet added in commit 97e2340.
Taxonomic JSON Construction
The JSON files were created from the TreeOfLife-200M catalog (if reproducing the process, be sure to use the correct revision for the intended model) and VernacularName.tsv component of the GBIF Backbone Taxonomy using make_txt_embedding_json.py through the following process:
- Null Value Filtering: Remove records where
kingdomorspeciesarenull. - Deduplication: Rows are deduplicated based on the combination of
kingdom,phylum,class,order,family,genus, andspecies. This ensures that each unique taxonomic combination appears exactly once.- Common Name Handling: Currently, the catalog metadata often contains multiple common names for a single unique taxonomic combination. During processing, the first English common name encountered for a given unique taxonomic combination is retained. If English is not available, the first option of any language is used. We plan future improvements to establish a definitive 1-to-1 mapping or a more comprehensive common name strategy.
- Corrupted Label Removal: Records where any rank looks like a CSV-parsing leak, specifically an ISO-8601 timestamp
(^\d{4}-\d{2}-\d{2}T\d{2}:\d{2})or the literal stringstrue/false, are removed. This was only necessary for the BioCLIP 2.5 Huge JSON.
Structure
The JSON file is a single top-level array. Each element within this array is itself an array of two elements:
- Inner Array (Index 0): A list of strings representing the full taxonomic path from
kingdomtospecies. - String (Index 1): The common name associated with that taxonomic combination.
Example
[
[
[
"Plantae",
"Bryophyta",
"Bryopsida",
"Bryales",
"Bryaceae",
"Bryum",
"gracile"
],
""
],
[
[
"Animalia",
"Chordata",
"Aves",
"Passeriformes",
"Mitrospingidae",
"Orthogonys",
"chloricterus"
],
"Olive-green tanager"
],
[
[
"Animalia",
"Arthropoda",
"Insecta",
"Lepidoptera",
"Lycaenidae",
"Orthomiella",
"rantaizana"
],
"Chinese Straight-wing Blue"
],
]