-
Notifications
You must be signed in to change notification settings - Fork 19.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AttributeError: 'Model' object has no attribute 'stateful_metric_names' #9394
Comments
Have you compiled your model? |
@Dref360 Thanks for your answer. Yes. |
I'm also seeing this error on Keras v2.1.4 only. For more information, I'm trying to load the model from files:
The error occurs in the predict_proba call, which should not need compiling.
On Keras 2.1.3, this returned the expected output.
|
Quick fix for both of you and I'll do something more permanent loaded_model = model_from_json(loaded_model_json)
# load weights into new model
loaded_model.load_weights(MODEL_WEIGHTS)
loaded_model.compile('sgd','mse') This won't affect your results for prediction in any way. |
works for me. Thanks. |
@Dref360 thank you very much. It seems, it solved my issue as well. |
Improvements to keras model again by training on more data. This time using 0.1m resolution imagery from Waikato. Tuakau was chosen as it was close to Auckland, and had a good amount of greenhouses (tile bb32_4735) to decrease bias and increase detection by a bit on those types of shiny buildings. Model trained on 100 epochs, resuming from the previous checkpoint (Wigram and Hastings), bringing total training to 300 epochs. Mean_iou accuracy metric is now >90%. TQDM progress bars added in the data processing step. predict.py script now accepts a threshold value, so one can run something like `python predict.py 512 50` to get a building detector of size 512*512 and probabilty >50%. DNN libraries updated to CUDA 9, CUDNN 7.0.5, Keras 2.1.4, Tensorflow 1.5 (from https://github.com/mind/wheels). There is a known issue keras-team/keras#9394 in having to compile a loaded model before predict can work...
@Dref360 thanks. so nice. |
this is my code
densenet_model = keras.applications.densenet.DenseNet201(weights=None, include_top=False, input_shape=(None,None,3)) input_img = densenet_model.get_layer('input_1').output model = Model(input_img, decoded) model.compile(loss="binary_crossentropy", optimizer='adadelta') for s in range(1000):
plt.imshow(x_test[i].reshape(28, 28))
showing error |
Hi,
I just upgrade my Keras to latest version and getting a error related to keras/engine/training on the code that used to work fine beforehand (my previous version was 2.1.0). I am not sure if it's some kind of deprectation or etc.
It's happening on a brach of Dropout + BB-alpha for detecting adversarial examples. Unfortunately, I coudn't share my own version due to disclusure of the project. Thanks for being understanding.
I found Add Stateful (Global) Metrics #9200, but I couldn't track down changes. Any idea how to solve the issue?
Thanks,
Shek
[checked] Check that you are up-to-date with the master branch of Keras. You can update with:
pip install git+git://github.com/keras-team/keras.git --upgrade --no-deps
[checked] If running on TensorFlow, check that you are up-to-date with the latest version. The installation instructions can be found here.
The text was updated successfully, but these errors were encountered: