Comments (8)
In tensorflow 2.10.1 I still have the same problem. I tracked it down to the PB model having multiple signatures.
I resolved by replacing the line:
prediction = model.predict(data)
with:
prediction = model.signatures["basic"](inputs = data)
I hope this helps anyone that may still have this issue.
from birdnet-analyzer.
@lagunabravo I did not get that error. Seems like maybe a path issue?
from birdnet-analyzer.
Thank you @abfleishman for the suggestion. I'm pretty sure it is not a path issue, as the model loads. I was quite succinct in my first post, the warning it gives, hinted in my question is:
WARNING:tensorflow:SavedModel saved prior to TF 2.5 detected when loading Keras model. Please ensure that you are saving the model with model.save() or tf.keras.models.save_model(), *NOT* tf.saved_model.save(). To confirm, there should be a file named "keras_metadata.pb" in the SavedModel directory.
A "keras_metadata.pb" is present with the 2k model, so I thought it may be just an absent file. I wonder if there is something else I'm missing, I'm using TF/Keras 2.6. You do successfully run the protobuf not the .tflite one?
from birdnet-analyzer.
@iamjeff any thoughts for lagunabravo?
from birdnet-analyzer.
I am running into the same issue.
As @lagunabravo wrote: The "keras_metadata.pb" is still present with the 2k model, and so does the following operation work without the error messages _UserObject' object has no attribute 'predict
And also without the mentioned warning.
The error would occur already after the following lines. In this case it works, as it is the V2.1.
model = tf.keras.models.load_model(".../BirdNET-Analyzer/checkpoints/V2.1/BirdNET_GLOBAL_2K_V2.1_Model/") print(model.summary())
As the warning says,maybe it was either not saved correctly: Please ensure that you are saving the model with model.save() or tf.keras.models.save_model(), *NOT* tf.saved_model.save().
Or it was saved with a TF version prior to 2.5?
WARNING:tensorflow:SavedModel saved prior to TF 2.5 detected when loading Keras model.
Update:
I think the issue is explained quite well here: tensorflow/models#8990 (comment)
from birdnet-analyzer.
This issue concerns an outdated model.
Please reopen if encountered again.
from birdnet-analyzer.
The problem persists with the most recent checkpoint (V2.4). I tested all checkpoints starting from V2.0 and the protobuf model does not seem to work since V2.2.
I tried running the analyze.py
script (latest code - 8762884) with default parameters on the example input file. I only changed the config.py
file in order to select the protobuf model and to adjust the model paths for testing each checkpoint ranging from V2.0 to V2.4. It worked perfectly with checkpoints V2.0 and V2.1, but when using any of the checkpoints starting from V2.2 onward I always got this same problem.
The full error message I got:
Traceback (most recent call last):
File "/home/sulzbals/git/BirdNET-Analyzer/analyze.py", line 287, in analyzeFile
p = predict(samples)
File "/home/sulzbals/git/BirdNET-Analyzer/analyze.py", line 225, in predict
prediction = model.predict(data)
File "/home/sulzbals/git/BirdNET-Analyzer/model.py", line 330, in predict
prediction = PBMODEL.predict(sample)
AttributeError: '_UserObject' object has no attribute 'predict'
from birdnet-analyzer.
I tested this with the current repo and tensorflow 2.15.0.
The PB model is working for me.
from birdnet-analyzer.
Related Issues (20)
- Creating a custom python script to use tflite model files : newby HOT 1
- Slow performance for analyze.py and embeddings.py HOT 1
- Add real-time detection HOT 1
- Adding BirdWeather integration to allow for PUC data processing HOT 5
- Issue with `segments.py` Not Saving Extracted Segments HOT 1
- Species list of the custom classifier has ANSI encoding and has to be converted to UTF-8 HOT 2
- Cannot utilize PBMODEL HOT 1
- Support different sampling modes in segments.py
- Link for Windows install leads to 404 error HOT 2
- Add internationalization HOT 1
- Segments not extracting to output directory (BirdNET GUI) HOT 1
- analyze.py seems to skip many files if it encounters a corrupt file HOT 4
- v1.1.0 Windows packaged version error from command line -- No such file or directory: 'labels\\label_names.csv' HOT 2
- Question on quality of Training Files
- Missing tensorflow - MacOS M1 HOT 5
- ModuleNotFoundError: No module named 'tflite_runtime' [Windows] HOT 2
- Raven list file not sorted
- [Information request] Are the android app and the website open-source ? HOT 1
- Utilize GPU when training
- Birdnet not responding after update HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from birdnet-analyzer.