Skip to content

Application for analyzing whether there is presence of snowmobile in an audiofile

License

Notifications You must be signed in to change notification settings

NINAnor/snowmobile_analyzer

Repository files navigation

Snowmobile analyzer ❄️

A model to detect whether snowmobiles are present in an acoustic dataset.

CC BY-NC-SA 4.0 Supported OS DOI

Introduction

This repository is made to run the snowmobile detector on your audio files.

Moreoever, in this repository we provide guidance on setting up a pipeline for real-time analysis of audio files on Google Cloud. For more information see the README in the subfolder cloud_analysis.

Use of the repository

Below are the intructions on installing and using the snowmobile detector with both Docker and without. The output of the script is a subfolder SNOWMOBILE_RESULTS containing the .csv file of the analyzed file. Note that the folder SNOWMOBILE_RESULTS will be located in the same folder as the input file.

Use with Docker

Create the Docker image image:

git clone https://github.com/NINAnor/snowmobile_analyzer.git
cd snowmobile_analyzer
docker build -t snowmobile -f Dockerfile .

Run the program using the analyze.sh script which is a wrapper around the Docker command

./analyze.sh ./example/example_audio.mp3 

Note that if you want to have more control over the arguments you can use Docker:

docker run \
    --rm \
    --gpus all \
    -v ./logs:/app/logs \ # Important to write the log files
    -v "$FOLDER_TO_EXPOSE":/data \
    snowmobile \
    --input /data/"$FILENAME"

Note that you can change ./example/example_audio.mp3 to the path of your own file.

Use without Docker

pip install -r requirements.txt

Copy the github repository and get the model from Zenodo.

cd ~ 
git clone https://github.com/NINAnor/snowmobile_analyzer.git
cd snowmobile-analyzer/audioclip
wget https://zenodo.org/record/7969521/files/assets.zip?download=1
unzip ./assets.zip?download=1
cd ../

Install the dependancies and update the PYTHONPATH:

poetry install --no-root
export PYTHONPATH="${PYTHONPATH}:~/snowmobile_analyzer/:~/snowmobile_analyzer/audioclip"

Run the script:

poetry run python src/predict.py --input example/example_audio.mp3

Output

The program creates a folder SNOWMOBILE_RESULTS containing a .csv file with the following columns:

start_detection end_detection label confidence hr
0 3 1 0.97691464 0.19687336119166438
3 6 1 0.9611957 0.16774687365839228
  • start_detection and end_detection are in seconds
  • label is always equal to 1 (i.e. snowmobile detected)
  • confidence is the model confidence
  • hr is the harmonic ratio value

By default the program select detections for which confidence > 0.95 and hr > 0.1.

Acknowlegment and contact

For bug reports please use the issues section.

For other inquiries please contact Benjamin Cretois or Femke Gelderblom

Cite this work

Cretois, B., Bick, I. A., Balantic, C., Gelderblom, F., Pavon-Jordan, D., Wiel, J., ... & Reinen, T. A. (2023). Snowmobile noise alters bird vocalization patterns during winter and pre-breeding season. bioRxiv, 2023-07.

About

Application for analyzing whether there is presence of snowmobile in an audiofile

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages