birdnet.acoustic.inference.core.prediction package

Submodules

birdnet.acoustic.inference.core.prediction.prediction_benchmarking module

class birdnet.acoustic.inference.core.prediction.prediction_benchmarking.FullBenchmarkMeta(_start_timepoint, _end_timepoint, _time_wall_time_s, _file_durations, file_formats, mem_result_total_memory_usage_MiB, mem_shm_size_file_indices_MiB, mem_shm_size_segment_indices_MiB, mem_shm_size_audio_samples_MiB, mem_shm_size_batch_sizes_MiB, mem_shm_size_flags_MiB, file_segments_total, model_segment_duration_seconds, _time_rampup_first_line_s, model_type, model_backend, model_version, model_is_custom, model_path, model_species, model_sig_fmin, model_sig_fmax, model_sample_rate, model_precision, file_segments_maximum, file_batches_processed, param_producers, param_workers, param_overlap_seconds, param_batch_size, param_prefetch_ratio, param_bandpass_fmin, param_bandpass_fmax, param_half_precision, param_devices, param_inference_library, worker_busy_average, worker_wait_time_average_milliseconds, speed_worker_xrt, speed_worker_xrt_max, _worker_avg_wall_time_s, mem_shm_ringsize, mem_memory_usage_maximum_MiB, mem_memory_usage_average_MiB, cpu_usage_maximum_pct, cpu_usage_average_pct, mem_shm_slots_average_free, mem_shm_slots_average_busy, mem_shm_slots_average_buffered, param_top_k, param_sigmoid_apply, param_sigmoid_sensitivity, param_confidence_threshold_default, param_confidence_threshold_custom, param_custom_species)

Bases: FullBenchmarkMetaBase

Attributes:
file_count
file_duration_average
file_duration_maximum
file_duration_minimum
file_duration_sum
hw_cpu
hw_cpu_logical_cores
hw_cpu_physical_cores
hw_host
hw_ram_GiB
mem_shm_size_total_MiB
mem_shm_slots_average_filled
speed_total_audio_per_second
speed_total_rtf
speed_total_seg_per_second
speed_total_xrt
speed_worker_rtf
speed_worker_total_audio_per_second
speed_worker_total_seg_per_second
sw_litert_available
sw_os
sw_package_version
sw_python_implementation
sw_python_version
sw_start_method
sw_tf_available
time_begin
time_end
time_iso
time_rampup_first_line
time_wall_time

Methods

to_dict

param_confidence_threshold_custom: int
param_confidence_threshold_default: float | None
param_custom_species: int
param_sigmoid_apply: bool
param_sigmoid_sensitivity: float | None
param_top_k: int | None
class birdnet.acoustic.inference.core.prediction.prediction_benchmarking.MinimalBenchmarkMeta(_start_timepoint, _end_timepoint, _time_wall_time_s, _file_durations, file_formats, mem_result_total_memory_usage_MiB, mem_shm_size_file_indices_MiB, mem_shm_size_segment_indices_MiB, mem_shm_size_audio_samples_MiB, mem_shm_size_batch_sizes_MiB, mem_shm_size_flags_MiB, file_segments_total, model_segment_duration_seconds)

Bases: MinimalBenchmarkMetaBase

Attributes:
file_count
file_duration_average
file_duration_maximum
file_duration_minimum
file_duration_sum
mem_shm_size_total_MiB
speed_total_audio_per_second
speed_total_rtf
speed_total_seg_per_second
speed_total_xrt
time_begin
time_end
time_wall_time

birdnet.acoustic.inference.core.prediction.prediction_result module

class birdnet.acoustic.inference.core.prediction.prediction_result.AcousticDataPredictionResult(tensor, species_list, input_durations, segment_duration_s, overlap_duration_s, speed, model_path, model_fmin, model_fmax, model_sr, model_precision, model_version)

Bases: AcousticPredictionResultBase

Attributes:
hop_duration_s
input_durations

Durations of each input in seconds.

inputs

Identifiers for each input processed by the result.

max_n_segments
memory_size_MiB

Memory usage for the base result metadata.

model_fmax

Upper bound of the model’s bandpass filter.

model_fmin

Lower bound of the model’s bandpass filter.

model_path
model_precision
model_sr

Sampling rate expected by the model.

model_version
n_inputs

Number of inputs in the result payload.

n_species
overlap_duration_s

Overlap duration between sliding windows in seconds.

segment_duration_s

Segment duration as configured on the inference pipeline.

species_ids
species_list
species_masked
species_probs
speed

Speed multiplier that was applied to the inputs.

top_k
unprocessable_inputs

Methods

to_dataframe()

Convert the structured array into a pandas DataFrame.

to_parquet(path, *[, compression, ...])

Write the contents to disk as an Arrow Parquet file.

load

save

to_arrow_table

to_csv

to_structured_array

class birdnet.acoustic.inference.core.prediction.prediction_result.AcousticFilePredictionResult(tensor, files, species_list, file_durations, segment_duration_s, overlap_duration_s, speed, model_path, model_fmin, model_fmax, model_sr, model_precision, model_version)

Bases: AcousticPredictionResultBase

Attributes:
hop_duration_s
input_durations

Durations of each input in seconds.

inputs

Identifiers for each input processed by the result.

max_n_segments
memory_size_MiB

Memory usage for the base result metadata.

model_fmax

Upper bound of the model’s bandpass filter.

model_fmin

Lower bound of the model’s bandpass filter.

model_path
model_precision
model_sr

Sampling rate expected by the model.

model_version
n_inputs

Number of inputs in the result payload.

n_species
overlap_duration_s

Overlap duration between sliding windows in seconds.

segment_duration_s

Segment duration as configured on the inference pipeline.

species_ids
species_list
species_masked
species_probs
speed

Speed multiplier that was applied to the inputs.

top_k
unprocessable_inputs

Methods

to_dataframe()

Convert the structured array into a pandas DataFrame.

to_parquet(path, *[, compression, ...])

Write the contents to disk as an Arrow Parquet file.

get_unprocessed_files

load

save

to_arrow_table

to_csv

to_structured_array

get_unprocessed_files()
Return type:

set[Path]

class birdnet.acoustic.inference.core.prediction.prediction_result.AcousticPredictionResultBase(inputs, input_durations, model_path, model_fmin, model_fmax, model_sr, model_precision, model_version, species_list, segment_duration_s, overlap_duration_s, speed, tensor)

Bases: AcousticResultBase

Attributes:
hop_duration_s
input_durations

Durations of each input in seconds.

inputs

Identifiers for each input processed by the result.

max_n_segments
memory_size_MiB

Memory usage for the base result metadata.

model_fmax

Upper bound of the model’s bandpass filter.

model_fmin

Lower bound of the model’s bandpass filter.

model_path
model_precision
model_sr

Sampling rate expected by the model.

model_version
n_inputs

Number of inputs in the result payload.

n_species
overlap_duration_s

Overlap duration between sliding windows in seconds.

segment_duration_s

Segment duration as configured on the inference pipeline.

species_ids
species_list
species_masked
species_probs
speed

Speed multiplier that was applied to the inputs.

top_k
unprocessable_inputs

Methods

to_dataframe()

Convert the structured array into a pandas DataFrame.

to_parquet(path, *[, compression, ...])

Write the contents to disk as an Arrow Parquet file.

load

save

to_arrow_table

to_csv

to_structured_array

property max_n_segments: int
property memory_size_MiB: float

Memory usage for the base result metadata.

Returns:

float: Memory used by metadata buffers in mebibytes.

property n_species: int
property species_ids: ndarray
property species_list: ndarray
property species_masked: ndarray
property species_probs: ndarray
to_arrow_table()
Return type:

Table

to_csv(path, *, encoding='utf-8', buffer_size_kb=1024, silent=False)
Return type:

None

to_structured_array()
Return type:

ndarray

property top_k: int
property unprocessable_inputs: ndarray

birdnet.acoustic.inference.core.prediction.prediction_tensor module

class birdnet.acoustic.inference.core.prediction.prediction_tensor.AcousticPredictionTensor(session_id, n_inputs, top_k, n_species, half_precision, input_indices_dtype, segment_indices_dtype, max_segment_index)

Bases: AcousticTensorBase

Attributes:
current_n_segments
memory_usage_mb
unprocessable_inputs

Methods

set_unprocessable_inputs

write_block

property current_n_segments: int
property memory_usage_mb: float
set_unprocessable_inputs(unprocessable_inputs)
Return type:

None

write_block(input_indices, segment_indices, top_k_species, top_k_scores, top_k_mask)
Return type:

None

birdnet.acoustic.inference.core.prediction.prediction_worker module

class birdnet.acoustic.inference.core.prediction.prediction_worker.PredictionWorker(session_id, backend_loader, top_k, species_thresholds, species_blacklist, batch_size, n_slots, rf_file_indices, rf_segment_indices, rf_audio_samples, rf_batch_sizes, rf_flags, segment_duration_samples, out_q, wkr_ring_access_lock, sem_free, sem_fill, sem_active_workers, half_precision, apply_sigmoid, sigmoid_sensitivity, wkr_stats_queue, logging_queue, logging_level, device, cancel_event, all_producers_finished, start_signal, finish_signal, end_event)

Bases: WorkerBase

Methods

__call__()

Call self as a function.

run_main

run_main_loop

Module contents