kahst / BirdNET-Analyzer

BirdNET analyzer for scientific audio data processing.
Other
871 stars 158 forks source link

Shifted Begin Time (s) reported in output table when using high overlap #384

Open scrameri opened 4 months ago

scrameri commented 4 months ago

Hi Stefan,

Many thanks for this amazing set of tools!

Describe the bug Using analyzer.py with --overlap 2.9 causes Begin Time (s) in the output file to be shifted relative to the true begin time in the audiofile. The reported time is a couple of seconds earlier. I didn't notice this behaviour when using --overlap 0.

Code Used

python3 analyze.py --i path/to/folder/ --slist path/to/results/ --o path/to/results/  --sensitivity 0.5 --min_conf 0.05 --fmin 0 --fmax 16000 --overlap 2.9 --output_file BirdNET.selection.table_sensitivity_0.5_fmax_16000_overlap_2.9.txt --locale de

Expected behavior Begin Time (s) is expected to exactly match the beginning of a call in the audio file, regardless of the --overlap setting.

Selection   View    Channel Begin Time (s)  End Time (s)    Low Freq (Hz)   High Freq (Hz)  Common Name Species Code    Confidence  Begin Path  File Offset (s)
1   Spectrogram 1   1   606.7000000000694   609.7000000000694   0   8000.0  Waldkauz    tawowl1 0.0974  path/to/folder/20240425_202300.WAV  606.7000000000694
2   Spectrogram 1   1   606.8000000000694   609.8000000000694   0   8000.0  Waldkauz    tawowl1 0.2410  path/to/folder/20240425_202300.WAV  606.8000000000694
3   Spectrogram 1   1   606.9000000000694   609.9000000000694   0   8000.0  Waldkauz    tawowl1 0.6160  path/to/folder/20240425_202300.WAV  606.9000000000694
4   Spectrogram 1   1   607.0000000000695   610.0000000000695   0   8000.0  Waldkauz    tawowl1 0.8510  path/to/folder/20240425_202300.WAV  607.0000000000695
5   Spectrogram 1   1   607.1000000000695   610.1000000000695   0   8000.0  Waldkauz    tawowl1 0.7917  path/to/folder/20240425_202300.WAV  607.1000000000695
6   Spectrogram 1   1   607.2000000000695   610.2000000000695   0   8000.0  Waldkauz    tawowl1 0.9630  path/to/folder/20240425_202300.WAV  607.2000000000695

However, the audiofile shows that the first call starts at ca. 610 seconds, about 3 seconds later than reported. In this case, the size of the shift is about the same as the size of --overlap.

Questions

Any help is appreciated!

Session Info

fegue commented 4 months ago

I don't know what is causing the issue. But, would you be willing to try the new birdnet Python package? The release 0.1.1 includes a new way to load the audio. It would be interesting to test it in your use-case and see if it returns the expected results. You can find the repository here https://github.com/birdnet-team/birdnet