birdnet_model_load {birdnetR} | R Documentation |
Initialize a BirdNET Model
Description
The various function of the birdnet_model_*
family are used to create and initialize diffent BirdNET models. Models will be downloaded if necessary.
-
birdnet_model_tflite()
: creates a tflite-model used for species prediction from audio. -
birdnet_model_custom()
: loads a custom model for species prediction from audio. -
birdnet_model_protobuf()
: creates a protobuf model for species prediction from audio that can be run on the GPU (GPU support so far only implemented on Apple Silicon). -
birdnet_model_meta()
: creates a meta model for species prediction from location and time.
Usage
birdnet_model_tflite(
version = "v2.4",
language = "en_us",
tflite_num_threads = NULL
)
birdnet_model_custom(
version = "v2.4",
classifier_folder,
classifier_name,
tflite_num_threads = NULL
)
birdnet_model_meta(
version = "v2.4",
language = "en_us",
tflite_num_threads = NULL
)
birdnet_model_protobuf(
version = "v2.4",
language = "en_us",
custom_device = NULL
)
Arguments
version |
character. The version of BirdNET to use (default is "v2.4", no other versions are currently supported). |
language |
character. Specifies the language code to use for the model's text processing. The language must be one of the available languages supported by the BirdNET model. |
tflite_num_threads |
integer. The number of threads to use for TensorFlow Lite operations. If NULL (default), the default threading behavior will be used. Will be coerced to an integer if possible. |
classifier_folder |
character. Path to the folder containing the custom classifier. |
classifier_name |
character. Name of the custom classifier. |
custom_device |
character. This parameter allows specifying a custom device on which computations should be performed.
If |
Details
Species Prediction from audio
Models created from birdnet_model_tflite()
, birdnet_model_custom()
, and birdnet_model_protobuf()
can be used to predict species within an audio file using predict_species_from_audio_file()
.
Species prediction from location and time
The birdnet_model_meta()
model can be used to predict species occurrence at a specific location and time of the year using predict_species_at_location_and_time()
.
Value
A BirdNET model object, which is an S3 object of class birdnet_model
and specific subclasses (e.g., birdnet_model_tflite
, birdnet_model_v2_4
). This object is a list containing:
py_model
The underlying Python BirdNET model object.
model_version
The version string of the model (e.g., "v2.4").
- ...
Additional elements specific to the model type:
-
For
birdnet_model_tflite
andbirdnet_model_meta
:-
language
: The language code used (e.g., "en_us"). -
tflite_num_threads
: The number of TFLite threads used (orNULL
).
-
-
For
birdnet_model_custom
:-
classifier_folder
: Path to the custom classifier folder. -
classifier_name
: Name of the custom classifier. -
tflite_num_threads
: The number of TFLite threads used (orNULL
).
-
-
For
birdnet_model_protobuf
:-
language
: The language code used (e.g., "en_us"). -
custom_device
: The custom device specified (orNULL
).
-
Note
Currently, all models can only be executed on the CPU. GPU support is only available on Apple Silicon.
See Also
available_languages()
predict_species_from_audio_file()
predict_species_at_location_and_time()
Examples
# Create a TFLite BirdNET model with 2 threads and English (US) language
## Not run:
birdnet_model <- birdnet_model_tflite(version = "v2.4", language = "en_us", tflite_num_threads = 2)
## End(Not run)