joeweiss / birdnetlib

A python api for BirdNET-Lite and BirdNET-Analyzer
https://joeweiss.github.io/birdnetlib/
Apache License 2.0
41 stars 14 forks source link

Fix issue with setting custom model/labels in Analyzer #92

Closed joeweiss closed 12 months ago

joeweiss commented 12 months ago

Fixes #91 and adds test case for configuration.

AnalyzerConfigurationError now raised if classifier_model_path and classifier_labels_path are not used together.

from birdnetlib.analyzer import Analyzer, AnalyzerConfigurationError
analyzer = Analyzer(classifier_model_path="/some/path/")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/birdnetlib/src/birdnetlib/analyzer.py", line 108, in __init__
    raise AnalyzerConfigurationError(
birdnetlib.analyzer.AnalyzerConfigurationError: Using a custom-trained classifier requires both classifier_model_path and classifier_labels_path