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, sw_start_method, 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_softmax_apply, param_sigmoid_sensitivity, param_confidence_threshold_default, param_confidence_threshold_custom, param_custom_species)

Bases: FullBenchmarkMetaBase

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_softmax_apply: bool
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

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

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, species_list_array=None)

Bases: AcousticPredictionResultBase

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, species_list_array=None)

Bases: AcousticResultBase

property max_n_segments: int
property memory_size_MiB: float

Memory usage for the base result metadata.

Returns:

Memory used by metadata buffers in mebibytes.

Return type:

float

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

copy_file_slice(file_idx, n_segments)

Return an independent copy of a single file’s tensor rows.

The returned arrays have shape (1, n_segments, top_k) so they can back a single-file result. Copying (rather than viewing) makes the data safe to hand to another thread while this tensor keeps being written/resized.

Must be called from the same thread that writes the tensor (the consumer); n_segments must not exceed the segments already written for the file.

Return type:

tuple[ndarray, ndarray, ndarray]

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

class birdnet.acoustic.inference.core.prediction.prediction_tensor.PrebuiltPredictionTensor(species_ids, species_probs, species_masked)

Bases: AcousticTensorBase

Minimal tensor holder wrapping already-materialised per-file arrays.

Used to build a single-file AcousticFilePredictionResult from the slice copied out of the shared result tensor, without re-running any inference.

property memory_usage_mb: float
write_block(*args, **kwargs)
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, apply_softmax, sigmoid_sensitivity, wkr_stats_queue, logging_queue, logging_level, device, cancel_event, all_producers_finished, start_signal, finish_signal, end_event, start_method)

Bases: WorkerBase

Module contents