BirdNET is great for analyzing files stored locally but we sometimes want to analyze files that are stored remotely. This repository aims to close that gap by using a modified version of BirdNET-Analyzer/analyze.py that leverages fsspec, a python library that help open files that are stored remotely.
This repository is made so that we can pull the changes made to the BirdNET repository without any conflict.
1- Clone this repository and install the dependancies
# Clone this repository:
git clone https://github.com/NINAnor/birdnetfs.git
cd birdnetfs
python -m venv .venv
source .venv/bin/activate
pip install requirements.txt
2- Clone the BirdNET repository:
birdnetfs
attempts to reuse BirdNET
functions as much as possible.
git clone https://github.com/kahst/BirdNET-Analyzer.git
mv BirdNET-Analyzer birdnetsrc
3- Analyze
First, you need to change the BirdNET config_file (NOT the config_connection.yaml) located in src/config.py
. More particularly you may want to change the OUTPUT_PATH
parameter which is the path where the output files will be created.
There is two options.
- First you can analyze a file of your chosing using:
export PYTHONPATH="${PYTHONPATH}:./src/birdnetsrc:src:birdnetsrc"
python analyse.py filecache::ssh://$USER:$PASSWORD@HOST:/PATH/TO/AUDIO/FILE1.mp3
- Or analyze multiple files in parallel (using GNU parallel):
In files_to_analyze.csv
list the files that you want to analyze
Then run:
sudo apt-get install parallel
time systemd-run --scope --user --property=CPUWeight=1 -- sh -c './analyse.sh'
Analyzing the files will return Birdnet.selection.table.txt
files in the OUTPUT_PATH_BIRDNET
.
1- Update the config_connection.yaml
2- Build a .parquet
database using:
python3 src/parse_results.py
⭐ Note that the database will contain $NUM_SEGMENT
at $THRESHOLD
. Both parameters saved in config_connection.yaml
.
3- Extract the detections!
./extract.sh