hiveeyes / audiohealth

Bee colony vitality using audio analysis. Applies machine learning algorithms in C++ from the OSBH project.
https://community.hiveeyes.org/t/rate-vitality-of-bee-colony-via-analysing-its-sound/357
GNU Affero General Public License v3.0
19 stars 7 forks source link

Improve robustness of analysis #8

Open amotl opened 2 years ago

amotl commented 2 years ago

Hi again,

@insipiens shared some promising news with us at ^1, where he outlined how to get more sane results after applying a filter curve EQ and normalizing the audio file beforehand -- thanks!

The procedure is currently based on Audacity - it would be sweet if we could integrate it into the repository in one way or another.

With kind regards, Andreas.

insipiens commented 2 years ago

I've made the version of audiohealth for docker public on my github repo public:

docker_audiohealth

Note it now has no pre-processing transforms via sox, I have recompiled the OSBH engine to 8k sample rate. I'm assuming the parameter for sample rate is provided for that reason(?)

I use inotifywait on the server side to call docker_healthaudio to process the incoming wav file.

I apply sox transforms to the input file prior to passing it to docker_audiohealth while testing.

inotify script:

#!/bin/bash
TARGET=/myftpdirectory
PROCESSED=/myprocessedaudiofiles

inotifywait -m -e create -e CLOSE_WRITE --format "%f" $TARGET \
        | while read FILENAME
                do
                        echo Detected new file $FILENAME
                        sleep 60   #delay in case of multiple ftp writes
                        echo moving $FILENAME to processed and running audiohealth
                        cp "$TARGET/$FILENAME" "$PROCESSED/rha_$FILENAME"
                        sleep 5
                        echo PreProcessing $FILENAME
                        sox "$PROCESSED/rha_$FILENAME" "$PROCESSED/$FILENAME" -S bass +6 50  0.5s #apply transform to received wav file prior to audiohealth
                        echo Processed $FILENAME
                        sleep 5
                        docker exec audiohealth python audiohealth.py analyze --audiofile ./samples/"$FILENAME" --analyzer tools/osbh-audioanalyzer/bin/test
                done
amotl commented 2 years ago

Dear John,

that looks excellent. Thank you very much for sharing your improvements. I will look into how to integrate them back into the main repository, if I can find some time.

With kind regards, Andreas.