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

Can't pass only custom classifier labels path to Analyzer #91

Closed noahBax closed 12 months ago

noahBax commented 12 months ago

I'm trying to pass just a custom classifier label path to the Analyzer constructor but not a custom model and it was failing. I found this in the Analyzer init function in the analyzer.py file

self.classifier_model_path = classifier_model_path
self.classifier_labels_path = classifier_labels_path
self.use_custom_classifier = (
    self.classifier_labels_path and self.classifier_labels_path
)

classifier_labels_path is checked both times instead of self.classifier_model_path and self.classifier_labels_path

joeweiss commented 12 months ago

Thanks @noahBax for spotting that. I'm fixing it now. The fix will go out as 0.12.1 later today.

Just to be clear, if you're trying to use only a species list with the default BirdNET-Analyzer model, then you should use custom_species_list_path.

custom_list_path = "predefined_species_list.txt"  # See example file for formatting.
analyzer = Analyzer(custom_species_list_path=custom_list_path)

If you're using models you've trained yourself, then classifier_model_path and classifier_labels_path are both used together.