birdnet-analyzer 2.2.0__tar.gz → 2.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/PKG-INFO +13 -8
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/README.md +1 -1
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/__init__.py +8 -1
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/analyze/cli.py +0 -1
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/analyze/core.py +61 -32
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/analyze/utils.py +43 -19
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/cli.py +8 -7
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/config.py +22 -6
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/embeddings/core.py +2 -2
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/embeddings/utils.py +5 -2
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/evaluation/assessment/performance_assessor.py +1 -1
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/evaluation/preprocessing/data_processor.py +3 -3
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/gui/__init__.py +2 -1
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/gui/analysis.py +11 -8
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/gui/assets/gui.js +6 -7
- birdnet_analyzer-2.4.0/birdnet_analyzer/gui/embeddings.py +278 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/gui/evaluation.py +2 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/gui/multi_file.py +40 -50
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/gui/review.py +1 -1
- birdnet_analyzer-2.2.0/birdnet_analyzer/gui/embeddings.py → birdnet_analyzer-2.4.0/birdnet_analyzer/gui/search.py +32 -329
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/gui/segments.py +1 -1
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/gui/single_file.py +51 -71
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/gui/train.py +3 -3
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/gui/utils.py +203 -103
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/lang/de.json +8 -2
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/lang/en.json +8 -2
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/lang/fi.json +8 -2
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/lang/fr.json +8 -2
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/lang/id.json +8 -2
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/lang/pt-br.json +8 -2
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/lang/ru.json +8 -2
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/lang/se.json +8 -2
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/lang/tlh.json +8 -2
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/lang/zh_TW.json +8 -2
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/model.py +83 -100
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/search/core.py +8 -1
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/search/utils.py +4 -4
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/segments/core.py +5 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/segments/utils.py +1 -1
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/species/utils.py +5 -0
- birdnet_analyzer-2.4.0/birdnet_analyzer/train/custom_models.py +36 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/train/utils.py +29 -64
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/translate.py +2 -3
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/utils.py +63 -17
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer.egg-info/PKG-INFO +13 -8
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer.egg-info/SOURCES.txt +2 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer.egg-info/requires.txt +13 -6
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/pyproject.toml +16 -9
- birdnet_analyzer-2.4.0/tests/test_utils.py +95 -0
- birdnet_analyzer-2.2.0/tests/test_utils.py +0 -28
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/LICENSE +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/analyze/__init__.py +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/analyze/__main__.py +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/audio.py +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/eBird_taxonomy_codes_2024E.json +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/embeddings/__init__.py +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/embeddings/__main__.py +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/embeddings/cli.py +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/evaluation/__init__.py +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/evaluation/__main__.py +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/evaluation/assessment/__init__.py +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/evaluation/assessment/metrics.py +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/evaluation/assessment/plotting.py +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/evaluation/preprocessing/__init__.py +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/evaluation/preprocessing/utils.py +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/gui/__main__.py +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/gui/assets/arrow_down.svg +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/gui/assets/arrow_left.svg +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/gui/assets/arrow_right.svg +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/gui/assets/arrow_up.svg +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/gui/assets/gui.css +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/gui/assets/img/birdnet-icon.ico +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/gui/assets/img/birdnet_logo.png +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/gui/assets/img/birdnet_logo_no_transparent.png +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/gui/assets/img/clo-logo-bird.svg +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/gui/localization.py +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/gui/settings.py +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/gui/species.py +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_af.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_ar.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_bg.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_ca.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_cs.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_da.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_de.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_el.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_en_uk.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_es.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_fi.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_fr.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_he.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_hr.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_hu.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_in.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_is.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_it.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_ja.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_ko.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_lt.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_ml.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_nl.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_no.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_pl.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_pt_BR.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_pt_PT.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_ro.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_ru.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_sk.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_sl.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_sr.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_sv.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_th.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_tr.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_uk.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/labels/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels_zh.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/search/__init__.py +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/search/__main__.py +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/search/cli.py +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/segments/__init__.py +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/segments/__main__.py +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/segments/cli.py +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/species/__init__.py +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/species/__main__.py +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/species/cli.py +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/species/core.py +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/train/__init__.py +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/train/__main__.py +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/train/cli.py +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer/train/core.py +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer.egg-info/dependency_links.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer.egg-info/entry_points.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/birdnet_analyzer.egg-info/top_level.txt +0 -0
- {birdnet_analyzer-2.2.0 → birdnet_analyzer-2.4.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: birdnet_analyzer
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.4.0
|
|
4
4
|
Summary: BirdNET analyzer for scientific audio data processing and bird classification.
|
|
5
5
|
Author: Stefan Kahl
|
|
6
6
|
Maintainer: Josef Haupt, Max Mauermann
|
|
@@ -11,7 +11,9 @@ Project-URL: Repository, https://github.com/birdnet-team/BirdNET-Analyzer
|
|
|
11
11
|
Project-URL: Issues, https://github.com/birdnet-team/BirdNET-Analyzer/issues
|
|
12
12
|
Project-URL: Download, https://github.com/birdnet-team/BirdNET-Analyzer/releases/latest
|
|
13
13
|
Keywords: birdnet,birdnet-analyzer
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
17
|
Classifier: Operating System :: OS Independent
|
|
16
18
|
Classifier: Topic :: Multimedia :: Sound/Audio :: Analysis
|
|
17
19
|
Classifier: Topic :: Scientific/Engineering
|
|
@@ -20,13 +22,14 @@ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
|
20
22
|
Requires-Python: >=3.11
|
|
21
23
|
Description-Content-Type: text/markdown
|
|
22
24
|
License-File: LICENSE
|
|
23
|
-
Requires-Dist: librosa
|
|
25
|
+
Requires-Dist: librosa>=0.11
|
|
24
26
|
Requires-Dist: resampy
|
|
25
|
-
Requires-Dist: tensorflow
|
|
26
|
-
Requires-Dist:
|
|
27
|
+
Requires-Dist: tensorflow>=2.20
|
|
28
|
+
Requires-Dist: pyarrow>=22.0.0; platform_system == "Darwin"
|
|
27
29
|
Requires-Dist: tqdm
|
|
28
30
|
Requires-Dist: pandas
|
|
29
31
|
Requires-Dist: matplotlib
|
|
32
|
+
Requires-Dist: kagglehub
|
|
30
33
|
Provides-Extra: train
|
|
31
34
|
Requires-Dist: keras-tuner; extra == "train"
|
|
32
35
|
Provides-Extra: server
|
|
@@ -34,14 +37,15 @@ Requires-Dist: bottle; extra == "server"
|
|
|
34
37
|
Requires-Dist: requests; extra == "server"
|
|
35
38
|
Provides-Extra: gui
|
|
36
39
|
Requires-Dist: birdnet-analyzer[embeddings,train]; extra == "gui"
|
|
37
|
-
Requires-Dist: gradio
|
|
38
|
-
Requires-Dist: pywebview; extra == "gui"
|
|
40
|
+
Requires-Dist: gradio>=5.46; extra == "gui"
|
|
41
|
+
Requires-Dist: pywebview>=6.0; extra == "gui"
|
|
42
|
+
Requires-Dist: pyobjc-framework-UniformTypeIdentifiers; platform_system == "Darwin" and extra == "gui"
|
|
39
43
|
Requires-Dist: plotly[express]; extra == "gui"
|
|
40
44
|
Requires-Dist: pywin32; platform_system == "Windows" and extra == "gui"
|
|
41
45
|
Requires-Dist: qtpy; platform_system == "Linux" and extra == "gui"
|
|
42
46
|
Requires-Dist: PyGObject; platform_system == "Linux" and extra == "gui"
|
|
43
47
|
Provides-Extra: embeddings
|
|
44
|
-
Requires-Dist: perch-hoplite; extra == "embeddings"
|
|
48
|
+
Requires-Dist: perch-hoplite>=0.1.1; extra == "embeddings"
|
|
45
49
|
Provides-Extra: all
|
|
46
50
|
Requires-Dist: birdnet-analyzer[gui,server]; extra == "all"
|
|
47
51
|
Provides-Extra: docs
|
|
@@ -51,6 +55,7 @@ Requires-Dist: sphinx-argparse; extra == "docs"
|
|
|
51
55
|
Provides-Extra: tests
|
|
52
56
|
Requires-Dist: pytest; extra == "tests"
|
|
53
57
|
Requires-Dist: pytest-timeout; extra == "tests"
|
|
58
|
+
Requires-Dist: pytest-order; extra == "tests"
|
|
54
59
|
Provides-Extra: dev
|
|
55
60
|
Requires-Dist: birdnet_analyzer[tests]; extra == "dev"
|
|
56
61
|
Requires-Dist: birdnet_analyzer[docs]; extra == "dev"
|
|
@@ -68,7 +73,7 @@ Dynamic: license-file
|
|
|
68
73
|
|
|
69
74
|

|
|
70
75
|

|
|
71
|
-
[](https://www.python.org/downloads/release/python-3120/)
|
|
72
77
|

|
|
73
78
|

|
|
74
79
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|

|
|
11
11
|

|
|
12
|
-
[](https://www.python.org/downloads/release/python-3120/)
|
|
13
13
|

|
|
14
14
|

|
|
15
15
|
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import warnings
|
|
3
|
+
|
|
1
4
|
from birdnet_analyzer.analyze import analyze
|
|
2
5
|
from birdnet_analyzer.embeddings import embeddings
|
|
3
6
|
from birdnet_analyzer.search import search
|
|
@@ -5,5 +8,9 @@ from birdnet_analyzer.segments import segments
|
|
|
5
8
|
from birdnet_analyzer.species import species
|
|
6
9
|
from birdnet_analyzer.train import train
|
|
7
10
|
|
|
8
|
-
__version__ = "2.
|
|
11
|
+
__version__ = "2.3.0"
|
|
9
12
|
__all__ = ["analyze", "embeddings", "search", "segments", "species", "train"]
|
|
13
|
+
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3"
|
|
14
|
+
os.environ["WRAPT_DISABLE_EXTENSIONS"] = "true"
|
|
15
|
+
|
|
16
|
+
warnings.filterwarnings("ignore")
|
|
@@ -27,6 +27,7 @@ def analyze(
|
|
|
27
27
|
threads: int = 8,
|
|
28
28
|
locale: str = "en",
|
|
29
29
|
additional_columns: list[str] | None = None,
|
|
30
|
+
use_perch: bool = False,
|
|
30
31
|
):
|
|
31
32
|
"""
|
|
32
33
|
Analyzes audio files for bird species detection using the BirdNET-Analyzer.
|
|
@@ -55,6 +56,7 @@ def analyze(
|
|
|
55
56
|
threads (int, optional): Number of CPU threads to use for analysis. Defaults to 8.
|
|
56
57
|
locale (str, optional): Locale for species names and output. Defaults to "en".
|
|
57
58
|
additional_columns (list[str] | None, optional): Additional columns to include in the output. Defaults to None.
|
|
59
|
+
use_perch (bool, optional): Whether to use the Perch model for analysis. Defaults to False.
|
|
58
60
|
Returns:
|
|
59
61
|
None
|
|
60
62
|
Raises:
|
|
@@ -69,9 +71,6 @@ def analyze(
|
|
|
69
71
|
import birdnet_analyzer.config as cfg
|
|
70
72
|
from birdnet_analyzer.analyze.utils import analyze_file, save_analysis_params
|
|
71
73
|
from birdnet_analyzer.analyze.utils import combine_results as combine
|
|
72
|
-
from birdnet_analyzer.utils import ensure_model_exists
|
|
73
|
-
|
|
74
|
-
ensure_model_exists()
|
|
75
74
|
|
|
76
75
|
flist = _set_params(
|
|
77
76
|
audio_input=audio_input,
|
|
@@ -98,6 +97,7 @@ def analyze(
|
|
|
98
97
|
threads=threads,
|
|
99
98
|
labels_file=cfg.LABELS_FILE,
|
|
100
99
|
additional_columns=additional_columns,
|
|
100
|
+
use_perch=use_perch,
|
|
101
101
|
)
|
|
102
102
|
|
|
103
103
|
print(f"Found {len(cfg.FILE_LIST)} files to analyze")
|
|
@@ -154,11 +154,14 @@ def _set_params(
|
|
|
154
154
|
threads,
|
|
155
155
|
labels_file=None,
|
|
156
156
|
additional_columns=None,
|
|
157
|
+
use_perch=False,
|
|
157
158
|
):
|
|
158
159
|
import birdnet_analyzer.config as cfg
|
|
159
160
|
from birdnet_analyzer.analyze.utils import load_codes
|
|
160
161
|
from birdnet_analyzer.species.utils import get_species_list
|
|
161
|
-
from birdnet_analyzer.utils import collect_audio_files, read_lines
|
|
162
|
+
from birdnet_analyzer.utils import collect_audio_files, ensure_model_exists, read_lines
|
|
163
|
+
|
|
164
|
+
ensure_model_exists(check_perch=use_perch)
|
|
162
165
|
|
|
163
166
|
if not isinstance(overlap, int | float):
|
|
164
167
|
raise ValueError("Overlap must be a numeric value.")
|
|
@@ -166,8 +169,11 @@ def _set_params(
|
|
|
166
169
|
if overlap < 0:
|
|
167
170
|
raise ValueError("Overlap must be a non-negative value.")
|
|
168
171
|
|
|
169
|
-
if overlap
|
|
170
|
-
raise ValueError(
|
|
172
|
+
if not use_perch and overlap > 2.9:
|
|
173
|
+
raise ValueError("Overlap must be less than or equal to 2.9 seconds for BirdNET model.")
|
|
174
|
+
|
|
175
|
+
if use_perch and overlap > 4.9:
|
|
176
|
+
raise ValueError("Overlap must be less than or equal to 4.9 seconds for Perch model.")
|
|
171
177
|
|
|
172
178
|
if not isinstance(audio_speed, int | float):
|
|
173
179
|
raise ValueError("Audio speed must be a numeric value.")
|
|
@@ -175,8 +181,10 @@ def _set_params(
|
|
|
175
181
|
if audio_speed <= 0:
|
|
176
182
|
raise ValueError("Audio speed must be a positive value.")
|
|
177
183
|
|
|
184
|
+
if use_perch and sensitivity != 1.0:
|
|
185
|
+
print("Warning: Sensitivity setting is ignored when using the Perch model.")
|
|
186
|
+
|
|
178
187
|
cfg.CODES = load_codes()
|
|
179
|
-
cfg.LABELS = read_lines(labels_file if labels_file else cfg.LABELS_FILE)
|
|
180
188
|
cfg.SKIP_EXISTING_RESULTS = skip_existing_results
|
|
181
189
|
cfg.LOCATION_FILTER_THRESHOLD = sf_thresh
|
|
182
190
|
cfg.TOP_N = top_n
|
|
@@ -188,10 +196,14 @@ def _set_params(
|
|
|
188
196
|
cfg.BANDPASS_FMIN = fmin
|
|
189
197
|
cfg.BANDPASS_FMAX = fmax
|
|
190
198
|
cfg.AUDIO_SPEED = audio_speed
|
|
191
|
-
cfg.RESULT_TYPES = rtype
|
|
199
|
+
cfg.RESULT_TYPES = rtype if isinstance(rtype, list | tuple | set) else [rtype]
|
|
192
200
|
cfg.COMBINE_RESULTS = combine_results
|
|
193
201
|
cfg.BATCH_SIZE = bs
|
|
194
202
|
cfg.ADDITIONAL_COLUMNS = additional_columns
|
|
203
|
+
cfg.USE_PERCH = use_perch
|
|
204
|
+
|
|
205
|
+
if cfg.USE_PERCH and custom_classifier:
|
|
206
|
+
raise ValueError("Selected custom classifier and Perch model, please select only one.")
|
|
195
207
|
|
|
196
208
|
if not output:
|
|
197
209
|
if os.path.isfile(cfg.INPUT_PATH):
|
|
@@ -213,20 +225,54 @@ def _set_params(
|
|
|
213
225
|
cfg.CPU_THREADS = 1
|
|
214
226
|
cfg.TFLITE_THREADS = threads
|
|
215
227
|
|
|
216
|
-
if
|
|
217
|
-
cfg.
|
|
228
|
+
if cfg.USE_PERCH:
|
|
229
|
+
cfg.MODEL_PATH = cfg.PERCH_V2_MODEL_PATH
|
|
230
|
+
cfg.LABELS_FILE = cfg.perch_labels_file()
|
|
231
|
+
cfg.SAMPLE_RATE = cfg.PERCH_SAMPLE_RATE
|
|
232
|
+
cfg.SIG_LENGTH = cfg.PERCH_SIG_LENGTH
|
|
233
|
+
cfg.LABELS = read_lines(cfg.LABELS_FILE)
|
|
234
|
+
cfg.LABELS = cfg.LABELS[1:] # it's a csv with header
|
|
235
|
+
else:
|
|
236
|
+
cfg.MODEL_PATH = cfg.BIRDNET_MODEL_PATH
|
|
237
|
+
cfg.LABELS_FILE = cfg.BIRDNET_LABELS_FILE
|
|
238
|
+
cfg.SAMPLE_RATE = cfg.BIRDNET_SAMPLE_RATE
|
|
239
|
+
cfg.SIG_LENGTH = cfg.BIRDNET_SIG_LENGTH
|
|
240
|
+
cfg.LABELS = read_lines(labels_file if labels_file else cfg.LABELS_FILE)
|
|
241
|
+
|
|
242
|
+
if overlap >= cfg.SIG_LENGTH:
|
|
243
|
+
raise ValueError(f"Overlap must be less than {cfg.SIG_LENGTH} seconds.")
|
|
244
|
+
|
|
245
|
+
cfg.CUSTOM_CLASSIFIER = custom_classifier # we treat this as absolute path, so no need to join with dirname
|
|
246
|
+
cfg.LATITUDE, cfg.LONGITUDE, cfg.WEEK = lat, lon, week
|
|
218
247
|
|
|
248
|
+
# TODO: Should really be None instead of -1
|
|
249
|
+
if cfg.LATITUDE == -1 and cfg.LONGITUDE == -1:
|
|
250
|
+
if not slist:
|
|
251
|
+
cfg.SPECIES_LIST_FILE = None
|
|
252
|
+
else:
|
|
253
|
+
cfg.SPECIES_LIST_FILE = slist
|
|
254
|
+
|
|
255
|
+
if os.path.isdir(cfg.SPECIES_LIST_FILE):
|
|
256
|
+
cfg.SPECIES_LIST_FILE = os.path.join(cfg.SPECIES_LIST_FILE, "species_list.txt")
|
|
257
|
+
|
|
258
|
+
cfg.SPECIES_LIST = read_lines(cfg.SPECIES_LIST_FILE, trim=True, fail_on_blank_lines=True)
|
|
259
|
+
else:
|
|
260
|
+
# TODO: What if only one of the two is given?
|
|
261
|
+
cfg.SPECIES_LIST_FILE = None
|
|
262
|
+
cfg.SPECIES_LIST = get_species_list(cfg.LATITUDE, cfg.LONGITUDE, cfg.WEEK, cfg.LOCATION_FILTER_THRESHOLD)
|
|
263
|
+
|
|
264
|
+
if custom_classifier:
|
|
219
265
|
if custom_classifier.endswith(".tflite"):
|
|
220
266
|
cfg.LABELS_FILE = custom_classifier.replace(".tflite", "_Labels.txt") # same for labels file
|
|
221
267
|
|
|
222
|
-
if not os.path.isfile(cfg.LABELS_FILE):
|
|
268
|
+
if not os.path.isfile(cfg.LABELS_FILE): # if the label file is not found, an old birdnet model might be used
|
|
223
269
|
cfg.LABELS_FILE = custom_classifier.replace("Model_FP32.tflite", "Labels.txt")
|
|
224
270
|
|
|
225
|
-
if not os.path.isfile(cfg.LABELS_FILE):
|
|
271
|
+
if not os.path.isfile(cfg.LABELS_FILE): # if the label file is still not found, dont use labels
|
|
226
272
|
cfg.LABELS_FILE = None
|
|
227
273
|
cfg.LABELS = None
|
|
228
274
|
else:
|
|
229
|
-
cfg.LABELS = read_lines(cfg.LABELS_FILE)
|
|
275
|
+
cfg.LABELS = read_lines(cfg.LABELS_FILE, fail_on_blank_lines=True)
|
|
230
276
|
else:
|
|
231
277
|
cfg.APPLY_SIGMOID = False
|
|
232
278
|
# our output format
|
|
@@ -234,26 +280,9 @@ def _set_params(
|
|
|
234
280
|
|
|
235
281
|
if not os.path.isfile(cfg.LABELS_FILE):
|
|
236
282
|
cfg.LABELS_FILE = os.path.join(custom_classifier, "assets", "label.csv")
|
|
237
|
-
cfg.LABELS = read_lines(cfg.LABELS_FILE)
|
|
238
|
-
else:
|
|
239
|
-
cfg.LABELS = [line.split(",")[1] for line in read_lines(cfg.LABELS_FILE)]
|
|
240
|
-
else:
|
|
241
|
-
cfg.LATITUDE, cfg.LONGITUDE, cfg.WEEK = lat, lon, week
|
|
242
|
-
cfg.CUSTOM_CLASSIFIER = None
|
|
243
|
-
|
|
244
|
-
if cfg.LATITUDE == -1 and cfg.LONGITUDE == -1:
|
|
245
|
-
if not slist:
|
|
246
|
-
cfg.SPECIES_LIST_FILE = None
|
|
283
|
+
cfg.LABELS = read_lines(cfg.LABELS_FILE, fail_on_blank_lines=True)
|
|
247
284
|
else:
|
|
248
|
-
cfg.
|
|
249
|
-
|
|
250
|
-
if os.path.isdir(cfg.SPECIES_LIST_FILE):
|
|
251
|
-
cfg.SPECIES_LIST_FILE = os.path.join(cfg.SPECIES_LIST_FILE, "species_list.txt")
|
|
252
|
-
|
|
253
|
-
cfg.SPECIES_LIST = read_lines(cfg.SPECIES_LIST_FILE)
|
|
254
|
-
else:
|
|
255
|
-
cfg.SPECIES_LIST_FILE = None
|
|
256
|
-
cfg.SPECIES_LIST = get_species_list(cfg.LATITUDE, cfg.LONGITUDE, cfg.WEEK, cfg.LOCATION_FILTER_THRESHOLD)
|
|
285
|
+
cfg.LABELS = [line.split(",")[1] for line in read_lines(cfg.LABELS_FILE, fail_on_blank_lines=True)]
|
|
257
286
|
|
|
258
287
|
if cfg.LABELS_FILE:
|
|
259
288
|
lfile = os.path.join(cfg.TRANSLATED_LABELS_PATH, os.path.basename(cfg.LABELS_FILE).replace(".txt", f"_{locale}.txt"))
|
|
@@ -55,7 +55,7 @@ def load_codes():
|
|
|
55
55
|
Returns:
|
|
56
56
|
A dictionary containing the eBird codes.
|
|
57
57
|
"""
|
|
58
|
-
with open(os.path.join(SCRIPT_DIR, cfg.CODES_FILE)) as cfile:
|
|
58
|
+
with open(os.path.join(SCRIPT_DIR, cfg.CODES_FILE), encoding="utf-8") as cfile:
|
|
59
59
|
return json.load(cfile)
|
|
60
60
|
|
|
61
61
|
|
|
@@ -92,17 +92,14 @@ def generate_raven_table(timestamps: list[str], result: dict[str, list], afile_p
|
|
|
92
92
|
selection_id += 1
|
|
93
93
|
label = cfg.TRANSLATED_LABELS[cfg.LABELS.index(c[0])] if cfg.TRANSLATED_LABELS else c[0]
|
|
94
94
|
code = cfg.CODES[c[0]] if c[0] in cfg.CODES else c[0]
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
)
|
|
95
|
+
lbl = label if cfg.USE_PERCH else label.split("_", 1)[-1]
|
|
96
|
+
rstring += f"{selection_id}\tSpectrogram 1\t1\t{start}\t{end}\t{low_freq}\t{high_freq}\t{lbl}\t{code}\t{c[1]:.4f}\t{afile_path}\t{start}\n"
|
|
98
97
|
|
|
99
98
|
# Write result string to file
|
|
100
99
|
out_string += rstring
|
|
101
100
|
|
|
102
101
|
# If we don't have any valid predictions, we still need to add a line to the selection table
|
|
103
102
|
# in case we want to combine results
|
|
104
|
-
# TODO: That's a weird way to do it, but it works for now. It would be better to keep track
|
|
105
|
-
# of file durations during the analysis.
|
|
106
103
|
if len(out_string) == len(RAVEN_TABLE_HEADER) and cfg.OUTPUT_PATH is not None:
|
|
107
104
|
selection_id += 1
|
|
108
105
|
out_string += f"{selection_id}\tSpectrogram 1\t1\t0\t3\t{low_freq}\t{high_freq}\tnocall\tnocall\t1.0\t{afile_path}\t0\n"
|
|
@@ -132,7 +129,7 @@ def generate_audacity(timestamps: list[str], result: dict[str, list], result_pat
|
|
|
132
129
|
for c in result[timestamp]:
|
|
133
130
|
label = cfg.TRANSLATED_LABELS[cfg.LABELS.index(c[0])] if cfg.TRANSLATED_LABELS else c[0]
|
|
134
131
|
ts = timestamp.replace("-", "\t")
|
|
135
|
-
lbl = label.replace("_", ", ")
|
|
132
|
+
lbl = label if cfg.USE_PERCH else label.replace("_", ", ")
|
|
136
133
|
rstring += f"{ts}\t{lbl}\t{c[1]:.4f}\n"
|
|
137
134
|
|
|
138
135
|
# Write result string to file
|
|
@@ -166,14 +163,21 @@ def generate_kaleidoscope(timestamps: list[str], result: dict[str, list], afile_
|
|
|
166
163
|
|
|
167
164
|
for c in result[timestamp]:
|
|
168
165
|
label = cfg.TRANSLATED_LABELS[cfg.LABELS.index(c[0])] if cfg.TRANSLATED_LABELS else c[0]
|
|
166
|
+
|
|
167
|
+
if cfg.USE_PERCH:
|
|
168
|
+
common = scientific = label
|
|
169
|
+
else:
|
|
170
|
+
split_label = label.split("_", 1)
|
|
171
|
+
scientific, common = split_label[0], split_label[-1]
|
|
172
|
+
|
|
169
173
|
rstring += "{},{},{},{},{},{},{},{:.4f},{:.4f},{:.4f},{},{},{}\n".format(
|
|
170
174
|
parent_folder.rstrip("/"),
|
|
171
175
|
folder_name,
|
|
172
176
|
filename,
|
|
173
177
|
start,
|
|
174
178
|
float(end) - float(start),
|
|
175
|
-
|
|
176
|
-
|
|
179
|
+
scientific,
|
|
180
|
+
common,
|
|
177
181
|
c[1],
|
|
178
182
|
cfg.LATITUDE,
|
|
179
183
|
cfg.LONGITUDE,
|
|
@@ -221,7 +225,14 @@ def generate_csv(timestamps: list[str], result: dict[str, list], afile_path: str
|
|
|
221
225
|
for c in result[timestamp]:
|
|
222
226
|
start, end = timestamp.split("-", 1)
|
|
223
227
|
label = cfg.TRANSLATED_LABELS[cfg.LABELS.index(c[0])] if cfg.TRANSLATED_LABELS else c[0]
|
|
224
|
-
|
|
228
|
+
|
|
229
|
+
if cfg.USE_PERCH:
|
|
230
|
+
common = scientific = label
|
|
231
|
+
else:
|
|
232
|
+
split_label = label.split("_", 1)
|
|
233
|
+
scientific, common = split_label[0], split_label[-1]
|
|
234
|
+
|
|
235
|
+
rstring += f"{start},{end},{scientific},{common},{c[1]:.4f},{afile_path}"
|
|
225
236
|
|
|
226
237
|
if columns_map:
|
|
227
238
|
rstring += "," + ",".join(str(val) for val in columns_map.values())
|
|
@@ -352,7 +363,11 @@ def combine_kaleidoscope_files(saved_results: list[str]):
|
|
|
352
363
|
None
|
|
353
364
|
"""
|
|
354
365
|
# Combine all files
|
|
355
|
-
with open(
|
|
366
|
+
with open(
|
|
367
|
+
os.path.join(cfg.OUTPUT_PATH, cfg.OUTPUT_KALEIDOSCOPE_FILENAME),
|
|
368
|
+
"w",
|
|
369
|
+
encoding="utf-8",
|
|
370
|
+
) as f:
|
|
356
371
|
f.write(KALEIDOSCOPE_HEADER)
|
|
357
372
|
|
|
358
373
|
for rfile in saved_results:
|
|
@@ -395,7 +410,7 @@ def combine_csv_files(saved_results: list[str]):
|
|
|
395
410
|
f.write(out_string)
|
|
396
411
|
|
|
397
412
|
|
|
398
|
-
def combine_results(saved_results: Sequence[dict[str, str] |
|
|
413
|
+
def combine_results(saved_results: Sequence[dict[str, str] | str]):
|
|
399
414
|
"""
|
|
400
415
|
Combines various types of result files based on the configuration settings.
|
|
401
416
|
This function checks the types of results specified in the configuration
|
|
@@ -410,13 +425,13 @@ def combine_results(saved_results: Sequence[dict[str, str] | None]):
|
|
|
410
425
|
None
|
|
411
426
|
"""
|
|
412
427
|
if "table" in cfg.RESULT_TYPES:
|
|
413
|
-
combine_raven_tables([f["table"] for f in saved_results if f])
|
|
428
|
+
combine_raven_tables([f["table"] for f in saved_results if isinstance(f, dict)])
|
|
414
429
|
|
|
415
430
|
if "kaleidoscope" in cfg.RESULT_TYPES:
|
|
416
|
-
combine_kaleidoscope_files([f["kaleidoscope"] for f in saved_results if f])
|
|
431
|
+
combine_kaleidoscope_files([f["kaleidoscope"] for f in saved_results if isinstance(f, dict)])
|
|
417
432
|
|
|
418
433
|
if "csv" in cfg.RESULT_TYPES:
|
|
419
|
-
combine_csv_files([f["csv"] for f in saved_results if f])
|
|
434
|
+
combine_csv_files([f["csv"] for f in saved_results if isinstance(f, dict)])
|
|
420
435
|
|
|
421
436
|
|
|
422
437
|
def merge_consecutive_detections(results: dict[str, list], max_consecutive: int | None = None):
|
|
@@ -515,7 +530,15 @@ def get_raw_audio_from_file(fpath: str, offset, duration):
|
|
|
515
530
|
The signal split into a list of chunks.
|
|
516
531
|
"""
|
|
517
532
|
# Open file
|
|
518
|
-
sig, rate = audio.open_audio_file(
|
|
533
|
+
sig, rate = audio.open_audio_file(
|
|
534
|
+
fpath,
|
|
535
|
+
cfg.SAMPLE_RATE,
|
|
536
|
+
offset,
|
|
537
|
+
duration,
|
|
538
|
+
cfg.BANDPASS_FMIN,
|
|
539
|
+
cfg.BANDPASS_FMAX,
|
|
540
|
+
cfg.AUDIO_SPEED,
|
|
541
|
+
)
|
|
519
542
|
|
|
520
543
|
# Split into raw audio chunks
|
|
521
544
|
return audio.split_signal(sig, rate, cfg.SIG_LENGTH, cfg.SIG_OVERLAP, cfg.SIG_MINLEN)
|
|
@@ -586,7 +609,7 @@ def predict(samples):
|
|
|
586
609
|
prediction = model.predict(data)
|
|
587
610
|
|
|
588
611
|
# Logits or sigmoid activations?
|
|
589
|
-
if cfg.APPLY_SIGMOID:
|
|
612
|
+
if cfg.APPLY_SIGMOID and not cfg.USE_PERCH:
|
|
590
613
|
prediction = model.flat_sigmoid(np.array(prediction), sensitivity=-1, bias=cfg.SIGMOID_SENSITIVITY)
|
|
591
614
|
|
|
592
615
|
return prediction
|
|
@@ -680,8 +703,9 @@ def analyze_file(item) -> dict[str, str] | None:
|
|
|
680
703
|
# Write error log
|
|
681
704
|
print(f"Error: Cannot analyze audio file {fpath}.\n", flush=True)
|
|
682
705
|
utils.write_error_log(ex)
|
|
706
|
+
msg = str(ex)
|
|
683
707
|
|
|
684
|
-
return
|
|
708
|
+
return msg or repr(ex).strip("()")
|
|
685
709
|
|
|
686
710
|
# Save as selection table
|
|
687
711
|
try:
|
|
@@ -692,7 +716,7 @@ def analyze_file(item) -> dict[str, str] | None:
|
|
|
692
716
|
print(f"Error: Cannot save result for {fpath}.\n", flush=True)
|
|
693
717
|
utils.write_error_log(ex)
|
|
694
718
|
|
|
695
|
-
return
|
|
719
|
+
return str(ex)
|
|
696
720
|
|
|
697
721
|
delta_time = (datetime.datetime.now() - start_time).total_seconds()
|
|
698
722
|
print(f"Finished {fpath} in {delta_time:.2f} seconds", flush=True)
|
|
@@ -139,7 +139,7 @@ def sigmoid_args():
|
|
|
139
139
|
"""
|
|
140
140
|
Creates an argument parser for sigmoid sensitivity.
|
|
141
141
|
This function sets up an argument parser with a single argument `--sensitivity`.
|
|
142
|
-
The sensitivity value is constrained to be within the range [0.
|
|
142
|
+
The sensitivity value is constrained to be within the range [0.5, 1.5], where higher
|
|
143
143
|
values result in higher detection sensitivity. The default value is taken from
|
|
144
144
|
`cfg.SIGMOID_SENSITIVITY`.
|
|
145
145
|
Returns:
|
|
@@ -148,9 +148,9 @@ def sigmoid_args():
|
|
|
148
148
|
p = argparse.ArgumentParser(add_help=False)
|
|
149
149
|
p.add_argument(
|
|
150
150
|
"--sensitivity",
|
|
151
|
-
type=lambda a: min(1.
|
|
151
|
+
type=lambda a: min(1.5, max(0.5, float(a))),
|
|
152
152
|
default=cfg.SIGMOID_SENSITIVITY,
|
|
153
|
-
help="Detection sensitivity; Higher values result in higher sensitivity. Values in [0.
|
|
153
|
+
help="Detection sensitivity; Higher values result in higher sensitivity. Values in [0.5, 1.5]. Values other than 1.0 will shift the sigmoid functionon the x-axis. Use complementary to the cut-off threshold.",
|
|
154
154
|
)
|
|
155
155
|
|
|
156
156
|
return p
|
|
@@ -168,8 +168,8 @@ def overlap_args(help_string="Overlap of prediction segments. Values in [0.0, 2.
|
|
|
168
168
|
p = argparse.ArgumentParser(add_help=False)
|
|
169
169
|
p.add_argument(
|
|
170
170
|
"--overlap",
|
|
171
|
-
type=lambda a: max(0.0, min(
|
|
172
|
-
default=
|
|
171
|
+
type=lambda a: max(0.0, min(4.9, float(a))),
|
|
172
|
+
default=0.0,
|
|
173
173
|
help=help_string,
|
|
174
174
|
)
|
|
175
175
|
|
|
@@ -398,6 +398,8 @@ def analyzer_parser():
|
|
|
398
398
|
help="Maximum number of consecutive detections above MIN_CONF to merge for each detected species. This will result in fewer entires in the result file with segments longer than 3 seconds. Set to 0 or 1 to disable merging. Set to None to include all consecutive detections. We use the mean of the top 3 scores from all consecutive detections for merging.",
|
|
399
399
|
)
|
|
400
400
|
|
|
401
|
+
parser.add_argument("--use_perch", action="store_true", help="Use the Perch model for detection.")
|
|
402
|
+
|
|
401
403
|
return parser
|
|
402
404
|
|
|
403
405
|
|
|
@@ -538,7 +540,7 @@ def segments_parser():
|
|
|
538
540
|
parser.add_argument(
|
|
539
541
|
"--seg_length",
|
|
540
542
|
type=lambda a: max(1.0, float(a)),
|
|
541
|
-
default=cfg.
|
|
543
|
+
default=cfg.BIRDNET_SIG_LENGTH,
|
|
542
544
|
help="Minimum length of extracted segments in seconds. If a segment is shorter than this value, it will be padded with audio from the source file.",
|
|
543
545
|
)
|
|
544
546
|
|
|
@@ -563,7 +565,6 @@ def segments_parser():
|
|
|
563
565
|
help="Number of bins to use for the balanced collection mode",
|
|
564
566
|
)
|
|
565
567
|
|
|
566
|
-
|
|
567
568
|
return parser
|
|
568
569
|
|
|
569
570
|
|
|
@@ -15,11 +15,13 @@ RANDOM_SEED: int = 42
|
|
|
15
15
|
|
|
16
16
|
MODEL_VERSION: str = "V2.4"
|
|
17
17
|
PB_MODEL: str = os.path.join(SCRIPT_DIR, "checkpoints/V2.4/BirdNET_GLOBAL_6K_V2.4_Model")
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
BIRDNET_MODEL_PATH: str = os.path.join(SCRIPT_DIR, "checkpoints/V2.4/BirdNET_GLOBAL_6K_V2.4_Model_FP32.tflite")
|
|
19
|
+
PERCH_V2_MODEL_PATH: str = os.path.join(SCRIPT_DIR, "checkpoints/perch_v2")
|
|
20
20
|
MDATA_MODEL_PATH: str = os.path.join(SCRIPT_DIR, "checkpoints/V2.4/BirdNET_GLOBAL_6K_V2.4_MData_Model_V2_FP16.tflite")
|
|
21
|
-
|
|
21
|
+
BIRDNET_LABELS_FILE: str = os.path.join(SCRIPT_DIR, "checkpoints/V2.4/BirdNET_GLOBAL_6K_V2.4_Labels.txt")
|
|
22
|
+
PERCH_LABELS_FILE: str = os.path.join(PERCH_V2_MODEL_PATH, "assets", "labels.csv")
|
|
22
23
|
TRANSLATED_LABELS_PATH: str = os.path.join(SCRIPT_DIR, "labels/V2.4")
|
|
24
|
+
USE_PERCH: bool = False
|
|
23
25
|
|
|
24
26
|
##################
|
|
25
27
|
# Audio settings #
|
|
@@ -28,13 +30,15 @@ TRANSLATED_LABELS_PATH: str = os.path.join(SCRIPT_DIR, "labels/V2.4")
|
|
|
28
30
|
# We use a sample rate of 48kHz, so the model input size is
|
|
29
31
|
# (batch size, 48000 kHz * 3 seconds) = (1, 144000)
|
|
30
32
|
# Recordings will be resampled automatically.
|
|
31
|
-
|
|
33
|
+
BIRDNET_SAMPLE_RATE: int = 48000
|
|
34
|
+
PERCH_SAMPLE_RATE: int = 32000
|
|
32
35
|
|
|
33
36
|
# We're using 3-second chunks
|
|
34
|
-
|
|
37
|
+
BIRDNET_SIG_LENGTH: float = 3.0
|
|
38
|
+
PERCH_SIG_LENGTH: float = 5.0
|
|
35
39
|
|
|
36
40
|
# Define overlap between consecutive chunks <3.0; 0 = no overlap
|
|
37
|
-
SIG_OVERLAP: float = 0
|
|
41
|
+
SIG_OVERLAP: float = 0.0
|
|
38
42
|
|
|
39
43
|
# Define minimum length of audio chunk for prediction,
|
|
40
44
|
# chunks shorter than 3 seconds will be padded with zeros
|
|
@@ -237,6 +241,10 @@ FILE_STORAGE_PATH: str = ""
|
|
|
237
241
|
# If None, no custom classifier will be used
|
|
238
242
|
# Make sure to set the LABELS_FILE above accordingly
|
|
239
243
|
CUSTOM_CLASSIFIER: str | None = None
|
|
244
|
+
MODEL_PATH: str | None = None
|
|
245
|
+
LABELS_FILE: str | None = None
|
|
246
|
+
SAMPLE_RATE: int | None = None
|
|
247
|
+
SIG_LENGTH: float | None = None
|
|
240
248
|
|
|
241
249
|
######################
|
|
242
250
|
# Get and set config #
|
|
@@ -250,3 +258,11 @@ def get_config():
|
|
|
250
258
|
def set_config(c: dict):
|
|
251
259
|
for k, v in c.items():
|
|
252
260
|
globals()[k] = v
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
#####################
|
|
264
|
+
# Convenience funcs #
|
|
265
|
+
#####################
|
|
266
|
+
|
|
267
|
+
def perch_labels_file():
|
|
268
|
+
return os.path.join(PERCH_V2_MODEL_PATH, "assets", "labels.csv")
|
|
@@ -43,11 +43,11 @@ def embeddings(
|
|
|
43
43
|
batch_size=2
|
|
44
44
|
)
|
|
45
45
|
"""
|
|
46
|
-
from birdnet_analyzer.embeddings.utils import
|
|
46
|
+
from birdnet_analyzer.embeddings.utils import extract_embeddings
|
|
47
47
|
from birdnet_analyzer.utils import ensure_model_exists
|
|
48
48
|
|
|
49
49
|
ensure_model_exists()
|
|
50
|
-
|
|
50
|
+
extract_embeddings(audio_input, database, overlap, audio_speed, fmin, fmax, threads, batch_size, file_output)
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
def try_get_database(db_path: str):
|
|
@@ -180,8 +180,11 @@ def consumer(q: mp.Queue, stop_at, database: str):
|
|
|
180
180
|
db.db.close()
|
|
181
181
|
|
|
182
182
|
|
|
183
|
-
def
|
|
184
|
-
|
|
183
|
+
def extract_embeddings(audio_input, database, overlap, audio_speed, fmin, fmax, threads, batchsize, file_output):
|
|
184
|
+
cfg.MODEL_PATH = cfg.BIRDNET_MODEL_PATH
|
|
185
|
+
cfg.LABELS_FILE = cfg.BIRDNET_LABELS_FILE
|
|
186
|
+
cfg.SAMPLE_RATE = cfg.BIRDNET_SAMPLE_RATE
|
|
187
|
+
cfg.SIG_LENGTH = cfg.BIRDNET_SIG_LENGTH
|
|
185
188
|
|
|
186
189
|
# Set input and output path
|
|
187
190
|
cfg.INPUT_PATH = audio_input
|
|
@@ -81,7 +81,7 @@ class PerformanceAssessor:
|
|
|
81
81
|
self.num_classes = num_classes
|
|
82
82
|
self.threshold = threshold
|
|
83
83
|
self.classes = classes
|
|
84
|
-
self.task = task
|
|
84
|
+
self.task: Literal["binary", "multilabel"] = task
|
|
85
85
|
self.metrics_list = metrics_list
|
|
86
86
|
|
|
87
87
|
# Set default colors for plotting
|
|
@@ -52,7 +52,7 @@ class DataProcessor:
|
|
|
52
52
|
prediction_file_name: str | None = None,
|
|
53
53
|
annotation_file_name: str | None = None,
|
|
54
54
|
class_mapping: dict[str, str] | None = None,
|
|
55
|
-
sample_duration:
|
|
55
|
+
sample_duration: float = 3.0,
|
|
56
56
|
min_overlap: float = 0.5,
|
|
57
57
|
columns_predictions: dict[str, str] | None = None,
|
|
58
58
|
columns_annotations: dict[str, str] | None = None,
|
|
@@ -68,7 +68,7 @@ class DataProcessor:
|
|
|
68
68
|
annotation_file_name (Optional[str]): Name of the annotation file to process.
|
|
69
69
|
class_mapping (Optional[Dict[str, str]]): Optional dictionary mapping raw class
|
|
70
70
|
names to standardized class names.
|
|
71
|
-
sample_duration (
|
|
71
|
+
sample_duration (float, optional): Length of each data sample in seconds. Defaults to 3.0.
|
|
72
72
|
min_overlap (float, optional): Minimum overlap required between prediction and
|
|
73
73
|
annotation to consider a match.
|
|
74
74
|
columns_predictions (Optional[Dict[str, str]], optional): Column name mappings for prediction files.
|
|
@@ -80,7 +80,7 @@ class DataProcessor:
|
|
|
80
80
|
ValueError: If any parameter is invalid (e.g., negative sample duration).
|
|
81
81
|
"""
|
|
82
82
|
# Initialize instance variables
|
|
83
|
-
self.sample_duration:
|
|
83
|
+
self.sample_duration: float = sample_duration
|
|
84
84
|
self.min_overlap: float = min_overlap
|
|
85
85
|
self.class_mapping: dict[str, str] | None = class_mapping
|
|
86
86
|
|
|
@@ -3,7 +3,7 @@ def main():
|
|
|
3
3
|
import birdnet_analyzer.gui.segments as gs
|
|
4
4
|
import birdnet_analyzer.gui.single_file as sfa
|
|
5
5
|
import birdnet_analyzer.gui.utils as gu
|
|
6
|
-
from birdnet_analyzer.gui import embeddings, evaluation, review, species, train
|
|
6
|
+
from birdnet_analyzer.gui import embeddings, evaluation, review, search, species, train
|
|
7
7
|
|
|
8
8
|
gu.open_window(
|
|
9
9
|
[
|
|
@@ -14,6 +14,7 @@ def main():
|
|
|
14
14
|
review.build_review_tab,
|
|
15
15
|
species.build_species_tab,
|
|
16
16
|
embeddings.build_embeddings_tab,
|
|
17
|
+
search.build_search_tab,
|
|
17
18
|
evaluation.build_evaluation_tab,
|
|
18
19
|
]
|
|
19
20
|
)
|