species
birdnet_stm32.data.species
¶
Species list utilities for dataset construction.
Provides functions to load, save, combine, and deduplicate species lists used for building class-structured training and test datasets.
load_species_list(path)
¶
Load a species list from a text file (one species per line).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to the species list file. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
List of species names (non-empty, stripped). |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the file does not exist. |
ValueError
|
If the resulting list is empty. |
Source code in birdnet_stm32/data/species.py
save_species_list(species, path)
¶
Save a species list to a text file (one species per line).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
species
|
list[str]
|
List of species names. |
required |
path
|
str
|
Output file path. |
required |
Source code in birdnet_stm32/data/species.py
open_species_list(path)
¶
Load and deduplicate a species list, sorted alphabetically.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str
|
Path to the species list file. |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Sorted, deduplicated list of species names. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the file does not exist. |
ValueError
|
If the resulting list is empty. |
Source code in birdnet_stm32/data/species.py
combine_species_lists(file_list, output_file, max_species=None)
¶
Combine multiple species list files using round-robin selection.
Reads species from each file, draws them round-robin, deduplicates while preserving order, optionally limits to max_species, sorts alphabetically, and writes the result.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_list
|
list[str]
|
Paths to species list files. |
required |
output_file
|
str
|
Path to write the combined list. |
required |
max_species
|
int | None
|
Maximum number of species to keep (None = no limit). |
None
|
Returns:
| Type | Description |
|---|---|
list[str]
|
The combined, sorted species list. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If any input file does not exist. |