From 7af08fad942a3e731235d6cb00e0b7f2ea392677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bengt=20L=C3=BCers?= Date: Tue, 18 Apr 2023 13:34:39 +0200 Subject: [PATCH 1/4] Rework Ubuntu Installation Instructions - Be explicit about Ubuntu version numbers - Clone repository first to keep the venv local - Be explicit about Python version numbers - Prefer using apt instead of apt-get - Add --yes flag to apt install subcommand - Use a virtual environment to not pollute the system - Install python packages in one command so that pip can resolve their dependencies properly - Use python executables from virtual environment for running analyse.py script --- README.md | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index d7f756fb..1f8adfce 100644 --- a/README.md +++ b/README.md @@ -119,38 +119,36 @@ print(recording.detections) For more examples and documentation, make sure to visit [pypi.org/project/birdnetlib/](https://pypi.org/project/birdnetlib/). For any feature request or questions regarding birdnetlib, please contact [Joe Weiss](mailto:joe.weiss@gmail.com) or add an issue or PR at [github.com/joeweiss/birdnetlib](https://github.com/joeweiss/birdnetlib). -## Setup (Ubuntu) +## Setup (Ubuntu 20.04) -Install Python 3: +Clone the repository ``` -sudo apt-get update -sudo apt-get install python3-dev python3-pip -pip3 install --upgrade pip +git clone https://github.com/kahst/BirdNET-Analyzer.git +cd BirdNET-Analyzer ``` -Install TFLite runtime (recommended) or Tensorflow (has to be 2.5 or later): +Install operating system packages: ``` -pip3 install tflite-runtime - -OR - -pip3 install tensorflow +sudo apt update +sudo apt install --yes python3.8-dev python3.8 python3.8-venv ffmpeg +python3.8 -m venv venv +venv/bin/python -m pip install --upgrade pip setuptools wheel ``` -Install Librosa to handle audio files: +Install TFLite runtime (recommended) or Tensorflow (has to be 2.5 or later) and librosa to handle audio files: + +Either: ``` -pip3 install librosa -sudo apt-get install ffmpeg +venv/bin/python -m pip install tflite-runtime librosa ``` -Clone the repository +Or: ``` -git clone https://github.com/kahst/BirdNET-Analyzer.git -cd BirdNET-Analyzer +venv/bin/python -m pip install tensorflow>=2.5.0 librosa ``` ## Setup (Windows) @@ -296,8 +294,16 @@ python analyze.py 2. Run `analyzer.py` to analyze an audio file. You need to set paths for the audio file and selection table output. Here is an example: +Under Linux and macOS: + +``` +venv/bin/python analyze.py --i ./audios --o ./outputs +``` + +Under Windows: + ``` -python3 analyze.py --i /path/to/audio/folder --o /path/to/output/folder +venv/Scripts/python.exe analyze.py --i ./audios --o ./outputs ``` NOTE: Your custom species list has to be named 'species_list.txt' and the folder containing the list needs to be specified with `--slist /path/to/folder`. You can also specify the number of CPU threads that should be used for the analysis with `--threads ` (e.g., `--threads 16`). If you provide GPS coordinates with `--lat` and `--lon`, the custom species list argument will be ignored. From 8f871a80ec67e2a5ba73a5d5d2acbd60ef754a57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bengt=20L=C3=BCers?= Date: Tue, 18 Apr 2023 13:41:37 +0200 Subject: [PATCH 2/4] Update README.md Add Nvidia LibCUDNN package to virtual environment for a roughtly 3x speedup --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1f8adfce..4a8f582b 100644 --- a/README.md +++ b/README.md @@ -142,15 +142,17 @@ Install TFLite runtime (recommended) or Tensorflow (has to be 2.5 or later) and Either: ``` -venv/bin/python -m pip install tflite-runtime librosa +venv/bin/python -m pip install tflite-runtime librosa nvidia-cudnn-cu11 ``` Or: ``` -venv/bin/python -m pip install tensorflow>=2.5.0 librosa +venv/bin/python -m pip install tensorflow>=2.5.0 librosa nvidia-cudnn-cu11 ``` +> NOTE: `nvidia-cudnn-cu11` works under Linux and with Nvidia GPUs, only. + ## Setup (Windows) Before you attempt to setup BirdNET-Analyzer on your Windows machine, please consider downloading our fully-packaged version that does not require you to install any additional packages and can be run "as-is". From 55ad0aecbbd20f0a5a6e929b7795a478247af2d2 Mon Sep 17 00:00:00 2001 From: bengt Date: Tue, 18 Apr 2023 16:06:29 +0200 Subject: [PATCH 3/4] Install resampy to enable analysing audio files using unexpected sample rates --- README.md | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4a8f582b..21beb24e 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ For more examples and documentation, make sure to visit [pypi.org/project/birdne ## Setup (Ubuntu 20.04) -Clone the repository +Clone the repository: ``` git clone https://github.com/kahst/BirdNET-Analyzer.git @@ -133,6 +133,11 @@ Install operating system packages: ``` sudo apt update sudo apt install --yes python3.8-dev python3.8 python3.8-venv ffmpeg +``` + +Create a virtual environment with packaging tools: + +``` python3.8 -m venv venv venv/bin/python -m pip install --upgrade pip setuptools wheel ``` @@ -142,13 +147,13 @@ Install TFLite runtime (recommended) or Tensorflow (has to be 2.5 or later) and Either: ``` -venv/bin/python -m pip install tflite-runtime librosa nvidia-cudnn-cu11 +venv/bin/python -m pip install tflite-runtime librosa nvidia-cudnn-cu11 resampy ``` Or: ``` -venv/bin/python -m pip install tensorflow>=2.5.0 librosa nvidia-cudnn-cu11 +venv/bin/python -m pip install tensorflow librosa nvidia-cudnn-cu11 resampy ``` > NOTE: `nvidia-cudnn-cu11` works under Linux and with Nvidia GPUs, only. From 7d29787f7cfe21f5bc95e73e9542bf0aedd89309 Mon Sep 17 00:00:00 2001 From: bengt Date: Tue, 18 Apr 2023 16:22:06 +0200 Subject: [PATCH 4/4] Use latest cuda --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 221ba570..c6f82a7f 100644 --- a/README.md +++ b/README.md @@ -147,13 +147,13 @@ Install TFLite runtime (recommended) or Tensorflow (has to be 2.5 or later) and Either: ``` -venv/bin/python -m pip install tflite-runtime librosa nvidia-cudnn-cu11 resampy +venv/bin/python -m pip install tflite-runtime librosa nvidia-cudnn-cu12 resampy ``` Or: ``` -venv/bin/python -m pip install tensorflow librosa nvidia-cudnn-cu11 resampy +venv/bin/python -m pip install tensorflow librosa nvidia-cudnn-cu12 resampy ``` > NOTE: `nvidia-cudnn-cu11` works under Linux and with Nvidia GPUs, only.