Skip to content

Slowed down audio (audio_speed < 1) leads to inaccurate timestamps #32

@Josef-Haupt

Description

@Josef-Haupt

Reproduction code:

import birdnet

target = (
  r"<path_to_analyzer>\birdnet_analyzer\example\soundscape.wav"
)
top_k = 1
batch_size = 1
prefetch_ratio = 3
overlap_duration_s = 1
bandpass_fmin = 0
bandpass_fmax = 15000
sigmoid_sensitivity = 1.0
speed = 0.1
default_confidence_threshold = 0
custom_species_list = None
progress_callback = None
show_stats = "progress"
n_workers = None
n_producers = 1
apply_sigmoid = True

if __name__ == "__main__":
  model = birdnet.load(
    "acoustic",
    "2.4",
    "tf",
  )
  result = model.predict(
    target,
    top_k=top_k,
    batch_size=batch_size,
    prefetch_ratio=prefetch_ratio,
    overlap_duration_s=overlap_duration_s,
    bandpass_fmin=bandpass_fmin,
    bandpass_fmax=bandpass_fmax,
    sigmoid_sensitivity=sigmoid_sensitivity,
    speed=speed,
    default_confidence_threshold=default_confidence_threshold,
    custom_species_list=custom_species_list,
    progress_callback=progress_callback,
    show_stats=show_stats,
    n_workers=n_workers,
    n_producers=n_producers,
    apply_sigmoid=apply_sigmoid,
  )
  df = result.to_dataframe()

  df.to_csv("output.csv", index=False)

Expected output (head):

input,start_time,end_time,species_name,confidence
C:\Users\johau\tuc\BirdNET-Analyzer-clone\birdnet_analyzer\example\soundscape.wav,0.0,0.3,Engine_Engine,0.021369556
C:\Users\johau\tuc\BirdNET-Analyzer-clone\birdnet_analyzer\example\soundscape.wav,0.2,0.5,Otus rufescens_Reddish Scops-Owl,0.16111241
C:\Users\johau\tuc\BirdNET-Analyzer-clone\birdnet_analyzer\example\soundscape.wav,0.4,0.7,Ciccaba virgata_Mottled Owl,0.15136504
C:\Users\johau\tuc\BirdNET-Analyzer-clone\birdnet_analyzer\example\soundscape.wav,0.6,0.9,Engine_Engine,0.019372134
C:\Users\johau\tuc\BirdNET-Analyzer-clone\birdnet_analyzer\example\soundscape.wav,0.8,1.1,Engine_Engine,0.011949962

Actual output (head):

input,start_time,end_time,species_name,confidence
C:\Users\johau\tuc\BirdNET-Analyzer-clone\birdnet_analyzer\example\soundscape.wav,0.0,0.2998,Engine_Engine,0.021369556
C:\Users\johau\tuc\BirdNET-Analyzer-clone\birdnet_analyzer\example\soundscape.wav,0.2,0.4998,Otus rufescens_Reddish Scops-Owl,0.16111241
C:\Users\johau\tuc\BirdNET-Analyzer-clone\birdnet_analyzer\example\soundscape.wav,0.4,0.6997,Ciccaba virgata_Mottled Owl,0.15136504
C:\Users\johau\tuc\BirdNET-Analyzer-clone\birdnet_analyzer\example\soundscape.wav,0.5996,0.8994,Engine_Engine,0.019372134
C:\Users\johau\tuc\BirdNET-Analyzer-clone\birdnet_analyzer\example\soundscape.wav,0.8,1.1,Engine_Engine,0.011949962

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions