Questions tagged [keras-2]

with a new API.

Keras API will now become available directly as part of

264 questions
0
votes
0 answers

why my below modified vgg-16 Keras model takes 1 hour to run one epoch

My model is Using TensorFlow backend. Found 8704 images belonging to 68 classes. Found 2176 images belonging to 68 classes. Found 1360 images belonging to 68…
BAE
  • 8,550
  • 22
  • 88
  • 171
0
votes
0 answers

Unexpected Keras predictions

I tried the keras tutorial that I found here... https://github.com/eijaz1/Building-a-CNN-in-Keras-Tutorial/blob/master/cnn_tutorial.ipynb Everything worked fine till line 10. But I am not able to predict correctly. I get the results like…
shantanuo
  • 31,689
  • 78
  • 245
  • 403
0
votes
0 answers

Getting keras ValueError during fitting of the model(loss and losses keyword issue)

num_classes=10 (d_tr,l_tr),(d_val,l_val) = mnist.load_data() l_tr = to_categorical(l_tr,num_classes) l_val = to_categorical(l_val,num_classes) d_tr = np.reshape(d_tr,(len(d_tr),28,28,1)) d_val = np.reshape(d_val,(len(d_val),28,28,1)) #d_tr =…
manav.tix
  • 101
  • 2
0
votes
0 answers

how to split input in a Keras model

I'm trying to do something that's pretty simple in keras with no success. I have an input X with size (?, 1452, 1). All I want to do is split this input to a vector of 1450 and a vector of 2 and deal with them seperately in the network. I tried: X1…
0
votes
1 answer

tensorflow: assigning weights after finalizing graph

Solution below If you are just interested in solving this problem, you can skip to my answer below. Original question I'm using tensorflow for reinforcement learning. A swarm of agents uses the model in parallel and one central entity trains it on…
lhk
  • 27,458
  • 30
  • 122
  • 201
0
votes
1 answer

Keras - Get the last layer before output

How can I get the reference to the last layer (the layer before the output) of the sequential/functional model in Keras? All layers can be retrieved with model.layers where the last layer is usually the last in the list but is there a guarantee that…
Primoz
  • 1,324
  • 2
  • 16
  • 34
0
votes
0 answers

Forcing Keras to create a different instance of custom layer

I have written a Keras custom layer foo (no trainable weights within it), which accepts an input x and returns x + n where n is additive white Gaussian noise with a pre-specified standard deviation. I wish to train my functional model model-trg,…
0
votes
0 answers

Unable to create a keras model. Error message expected dense_67_input to have 2 dimensions, but got array with shape (3, 1, 36)

I am using keras to create a model using the url https://github.com/tensorflow/workshops/blob/master/extras/keras-bag-of-words/keras-bow-model.ipynb as the reference/guide. The only difference in the approach between the one mentioned in the above…
Timothy Rajan
  • 1,947
  • 8
  • 38
  • 62
0
votes
0 answers

Keras get_weights() doesn't show full output

I'm currently using Keras to solve a regression problem. And I want the weights of my layers (embedding layers). I'm using layer.get_weights() from keras, but it doesn't show me the full output. Already tried to save_weights() but when I try to…
0
votes
2 answers

Keras 2 ZeroPadding2D output shape

I am trying to replicate Tim O'shea's RadioML on python3.5 before I play around with it and have been making edits to his publicly available code:…
0
votes
1 answer

Inverting keras.layers.Add() layer in Keras

I have an issue that seems to have no straight forward solution in Keras. My server runs on ubuntu 14.04, keras with backend tensorflow. Here's the issue: I have used keras.layers.Add() to add two outputs from two Conv2D layers in keras. Now I wish…
geek
  • 65
  • 2
  • 11
0
votes
1 answer

How to efficiently mask tensors in tensorflow only given the indices of the last axis?

Imagine I have a tensor of shape (batch_size, a, ... , c, d, e)where are a, ... ,c,d,e are defined integers. For example (batch_size, 500, 3, 2, 2, 69) or (batch_size, 2, 2). My question is for all tensors but let's stick to the example of…
Perm. Questiin
  • 429
  • 2
  • 9
  • 21
0
votes
1 answer

How to map classes from predict_classes() to their respective jpeg files?

i am using flow from directory to fetch the images and create a generator which i am then using in a predict_generator for predicting probabilities and classes. The problem is that when i predict both, the labels get shuffled although i am not using…
Rehan Aziz
  • 123
  • 12
0
votes
1 answer

ValueError: Error when checking input: expected dense_1_input to have 4 dimensions, but got array with shape (20593, 4, 1)

I am trying to follow sentdex's game ai bot tutorial(https://www.youtube.com/watch?v=G-KvpNGudLw), but instead of tflearn, I am trying to use keras for the same implementation. Model Function def neural_network_model(input_size): network =…
0
votes
2 answers

Error when trying to output previous to last layer in Keras

I am trying to output the previous to last Dense layer in a keras model. I first load the model architecture and the weights: base_model = applications.ResNet50(weights = None, include_top = False, …
Jadiel de Armas
  • 8,405
  • 7
  • 46
  • 62