Questions tagged [keras-2]

with a new API.

Keras API will now become available directly as part of

264 questions
11
votes
2 answers

How to use TensorFlow metrics in Keras

There seem to be several threads/issues on this already but it doesn't appear to me that this has been solved: How can I use tensorflow metric function within keras…
davhab
  • 805
  • 2
  • 9
  • 17
10
votes
3 answers

shouldn't model.trainable=False freeze weights under the model?

I am trying to freeze the free trained VGG16's layers ('conv_base' below) and add new layers on top of them for feature extracting. I expect to get same prediction results from 'conv_base' before(ret1) / after(ret2) fit of model but it is not. Is…
page
  • 121
  • 1
  • 4
9
votes
1 answer

Keras network can never classify the last class

I have been working on my project Deep Learning Language Detection which is a network with these layers to recognise from 16 programming languages: And this is the code to produce the network: # Setting up the model graph_in =…
Aliostad
  • 80,612
  • 21
  • 160
  • 208
9
votes
2 answers

Keras Multi-inputs AttributeError: 'NoneType' object has no attribute 'inbound_nodes'

I'm trying to build a model as ilustrated in below diagram. The idea is to take more than one categorical features (one-hot vectors) and embed them separately, then combine those embedded vectors with a 3D tensor for a LSTM. With following code in…
LingxB
  • 497
  • 3
  • 7
  • 17
8
votes
6 answers

AttributeError: module 'tensorflow' has no attribute 'get_default_graph'

I am doing some task related to image captioning and I have loaded the weights of inception model like this model = InceptionV3(weights='imagenet') But I am getting error like this: AttributeError: module 'tensorflow' has no attribute…
Ayush Kushwaha
  • 93
  • 1
  • 1
  • 9
7
votes
1 answer

AttributeError: module 'keras.backend' has no attribute 'common'

I tried to execute some project. But I've got an attribute error. I checked my Tensorflow and Keras version. Name: tensorflow Version: 2.3.1 Name: Keras Version: 2.4.3 Summary: Deep Learning for humans python 3.8.2 The code is…
Sai
  • 75
  • 1
  • 5
7
votes
4 answers

The clear_session() method of keras.backend does not clean up the fitting data

I am working on a comparison of the fitting accuracy results for the different types of data quality. A "good data" is the data without any NA in the feature values. A "bad data" is the data with NA in the feature values. A "bad data" should be…
Ruben Kazumov
  • 3,803
  • 2
  • 26
  • 39
7
votes
1 answer

Keras dot/Dot layer behavior on 3D tensors

The Keras documentation for the dot/Dot layer states that: "Layer that computes a dot product between samples in two tensors. E.g. if applied to a list of two tensors a and b of shape (batch_size, n), the output will be a tensor of shape …
Kate A Baumli
  • 123
  • 1
  • 6
7
votes
1 answer

Keras: Attention Mechanism For Text Summarization

I'm trying to implement Attention mechanism in order to produce abstractive text summarization using Keras by taking a lot of help from this GitHub thread where there is a lot of informative discussion about the implementation. I'm struggling to…
Krishnang K Dalal
  • 2,322
  • 9
  • 34
  • 55
7
votes
1 answer

Report Keras model evaluation metrics every 10 epochs?

I'd like to know the specificity and sensitivity of my model. Currently, I'm evaluating the model after all epochs are finished: from sklearn.metrics import confusion_matrix predictions = model.predict(x_test) y_test = np.argmax(y_test,…
A T
  • 13,008
  • 21
  • 97
  • 158
7
votes
1 answer

Keras 2.0.0: how to access and modify the training data in the callback function "on_epoch_end()"?

I am using Keras 2.0.0 with Theano. I would like to update the training data between each epoch. I can do it in a for loop using nb_epochs=1 but it would be much more elegant using the on_epoch_end callback. Here is my tentative code, based on a…
topel
  • 71
  • 3
7
votes
3 answers

Can not save model using model.save following multi_gpu_model in Keras

Following the upgrade to Keras 2.0.9, I have been using the multi_gpu_model utility but I can't save my models or best weights using model.save('path') The error I get is TypeError: can’t pickle module objects I suspect there is some problem…
GhostRider
  • 2,109
  • 7
  • 35
  • 53
7
votes
1 answer

Keras initializers outside Keras

I want to initialize a 4*11 matrix using glorot uniform in Keras, using following code: import keras keras.initializers.glorot_uniform((4,11)) I get this output : How can I visualize the…
Hitesh
  • 1,285
  • 6
  • 20
  • 36
6
votes
2 answers

CancelledError: [_Derived_]RecvAsync is cancelled

I am having an issue. I run the same code on my local machine with CPU and Tensorflow 1.14.0. It works fine. However, when I run it on GPU with Tensorflow 2.0, I get CancelledError: [_Derived_]RecvAsync is cancelled. [[{{node…
ARAT
  • 884
  • 1
  • 14
  • 35
6
votes
1 answer

Monitor F1 Score (or a custom metric in general) in a keras callback

Keras 2.0 removed F1 score, but I would like to monitor its value. I am using a sequential model to train a Neural Net. I defined a function, as suggested here How to calculate F1 Macro in Keras?. This function works fine only if used it inside…
1
2
3
17 18