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

RuntimeError with birdnetlib and Custom Model Analysis #96

Closed mohedano-munoz closed 10 months ago

mohedano-munoz commented 11 months ago

Issue Description:

I am encountering a runtime error when attempting to use a custom model trained with birdnet-analyzer and performing analysis with birdnetlib. The specific error message I am receiving is:

RuntimeError: tensorflow/lite/kernels/concatenation.cc:162 t->dims->data[d] != t0->dims->data[d] (1 != 0)Node number 92 (CONCATENATION) failed to prepare.

Python Code:

from birdnetlib.analyzer import Analyzer
from birdnetlib import Recording

model_path = '/path_to_file/test_2.tflite'
labels_path = '/path_to_file/test_2_Labels.txt'

analyzer = Analyzer(classifier_labels_path=labels_path, classifier_model_path=model_path)

recording = Recording(
    analyzer,
    'path_to_audio_file',
    min_conf=0.1
)

recording.analyze()

Environment:

Operating System: Ubuntu 23.10 Python Version: 3.11.5 Birdnetlib Version: 0.12.3

Thank you for your attention to this matter. Let me know if you need further details or clarification.

joeweiss commented 11 months ago

Hi @mohedano-munoz.

Which version of BirdNET-Analyzer was the custom model trained with?

Also, can you confirm that the error does not appear when you use BirdNET-Analyzer's analyze.py with the --classifier argument as outlined here?

Thanks.

mohedano-munoz commented 11 months ago

Hello, the version of BirdNET Analyzer that I'm using is the latest one available on GitHub in its main branch (Revision number: f42e4bf3adc3824b8ab4ec61f151096eb44ebf8f). I have tried running it with BirdNET Analyzer on the same audio files with its version, and it works correctly.

Greetings, and thank you very much for everything.

joeweiss commented 11 months ago

Thanks. Is there any chance I can get those custom model files?

If you'd rather not share them publicly, you can email me at joe.weiss@gmail.com. That would greatly reduce the time it takes to debug this issue. If you need an upload location for the files, I'll be happy to reply with a Dropbox link.

Also, it would help to have the installed libraries for your environment (pip freeze or pip3 freeze).

Thanks!

joeweiss commented 10 months ago

Closing this issue since there hasn't been any response. If you encounter this issue again or have additional information to share, please reopen the issue. Thanks for your understanding!

mohedano-munoz commented 10 months ago

Hi Joe

I'm sorry for not replying here. I sent the generated model through the email address. I have just forwarded the email to you with the model and the environment.

Thank you very much, and greetings!