Analyzing stereo files takes twice the time of mono files
The code clearly loads audio files as mono in audio.py Do you have any idea why BirdNET still takes twice the time?
This happens on a RaspberryPi 3A+ Memory usage is similar when analyzing mono files. The function librosa.load(..., mono = True) executes almost instantaneously
Hmmm, weird, do you have a sample file that I can use to try to replicate this behavior?
Well ok, so its not always double the time but it always takes significantly longer. The audio files were recorded in stereo and then converted to mono using ffmpeg (10min & Sample rate 48 kHz). 1 File (10 min): Mono 70s ; Stereo 90s 2 Files (à 10 min): Mono 110s; Stereo 260s 3 Files: Mono 190s; Stereo 460s
CPU_THREADS = 1 TFLITE_THREADS = 4
Example files are here https://oekofor.ddns.net/index.php/s/7mMXFWGNTeCTYkp
I wasn't able to reproduce the issue, which machine and model did you use to run the test?
This is the log from my workstation PC using only one CPU thread:
Analyzing example/mono/SN99_2022-04-07T084531+0000.wav
Finished example/mono/SN99_2022-04-07T084531+0000.wav in 18.88 seconds
Analyzing example/mono/SN99_2022-04-07T084531+0000_2.wav
Finished example/mono/SN99_2022-04-07T084531+0000_2.wav in 18.30 seconds
Analyzing example/mono/SN99_2022-04-07T084531+0000_2_mono.wav
Finished example/mono/SN99_2022-04-07T084531+0000_2_mono.wav in 17.58 seconds
Analyzing example/mono/SN99_2022-04-07T084531+0000_3.wav
Finished example/mono/SN99_2022-04-07T084531+0000_3.wav in 18.23 seconds
Analyzing example/mono/SN99_2022-04-07T084531+0000_3_mono.wav
Finished example/mono/SN99_2022-04-07T084531+0000_3_mono.wav in 17.43 seconds
Analyzing example/mono/SN99_2022-04-07T084531+0000_mono.wav
Finished example/mono/SN99_2022-04-07T084531+0000_mono.wav in 17.43 seconds
I ran the tests on a Raspberry Pi 3A+, 512mb Ram and a 2Gb Swapfile which fills up quite a bit. The model version is 1.4 and it runs on tflite-runtime without the full tensorflow installation.
Did you find a solution or workaround for that issue? Haven't been able to reproduce the behavior so far.
@fegue -> try placing the audio files into /tmp ramdisk, and analyzing from there, trying to rule out the SD card reads. Also, if you are using client/server.py, then server saves temporary file to local folder, again, you can edit the file to move it to /tmp.