Questions tagged [keras-2]

with a new API.

Keras API will now become available directly as part of

264 questions
0
votes
1 answer

No change in loss or accuracy

I'm using sample code from Keras blogs (with a few tweaks) but when running my model's loss and accuracy metrics aren't improving. I'm not sure if implementing some function incorrectly. I'm loading images from a saved file(h5py) and in small…
Moondra
  • 4,399
  • 9
  • 46
  • 104
0
votes
1 answer

Keras: Dense vs. Embedding - ValueError: Input 0 is incompatible with layer repeat_vector_9: expected ndim=2, found ndim=3

I have the following network which works fine: left = Sequential() left.add(Dense(EMBED_DIM,input_shape=(ENCODE_DIM,))) left.add(RepeatVector(look_back)) However, I need to replace the Dense layer with the Embedding layer: left =…
Edamame
  • 23,718
  • 73
  • 186
  • 320
0
votes
1 answer

Keras: Merge/Concatenate Layer: TypeError: __init__() got multiple values for argument 'axis'

I created the following network. The idea is to combine the outputs of the left and right, then send to a LSTM model. EMBED_DIM = 4 look_back = 6 feature_num = 2 ENCODE_DIM = 676 left =…
Edamame
  • 23,718
  • 73
  • 186
  • 320
0
votes
1 answer

Keras cross-validation accuracy settling at (1/output_classes) after each epoch

I am currently trying to train a DNN for speech recognition with large number of speakers, each having their own label (output_classes = Total number of speakers). My database right now has 300 speakers and the Keras model summary is as…
0
votes
1 answer

Keras Initializers of a particular shape

I make a small keras model and get weights of model using following code: from keras.models import Sequential from keras.layers import Dense, Flatten,Conv2D, MaxPooling2D input_shape = (28, 28, 1) model = Sequential() model.add(Conv2D(1,…
Hitesh
  • 1,285
  • 6
  • 20
  • 36
0
votes
1 answer

model.load_weights() giving incorrect results

I train MNIST data using following CNN model and save weights as mnist_weights.h5 for reproducing the result. import keras from __future__ import print_function from keras.datasets import mnist from keras.models import Sequential from keras.layers…
Hitesh
  • 1,285
  • 6
  • 20
  • 36
0
votes
3 answers

Reshape intermediate layer in Keras

I have an issue to reshape an intermediate layer after a Convolution1D layer. The output of the convolution layer is (None, 15, 30) and I want to reshape it into (None, 15, 30, 1). Here the piece of code: model = Sequential() model.add(Reshape((-1,…
0
votes
1 answer

Why 2 almost equal Keras CNN returns 2 quite different results

I'm addressing a sentence-level binary classification task. My data consists of 3 subarrays of tokens: left context, core, and right context. I used Keras to devise several alternatives of Convolutional Neural Networks and validate which one best…
Fernando Ortega
  • 696
  • 6
  • 15
0
votes
1 answer

Error when checking input: expected acc_input to have 4 dimensions, but got array with shape (200, 3, 1)

I have tried many times and read the answer to the question similar to me, but still did not solve. Error when checking input: expected acc_input to have 4 dimensions, but got array with shape (200, 3,…
xianglala
  • 41
  • 2
0
votes
2 answers

How can I create a (None,299,299,3) from (299,299,3)?

I am trying to use the Keras 2 incepctionV3 based trained model to predict an image for testing purpose. My original model work well, then I try to create a model with specified input_shape (299,299,3) base_model = InceptionV3(weights='imagenet',…
Kuroro
  • 1,841
  • 1
  • 19
  • 32
0
votes
1 answer

Memory leak using flow_from_directory

I'm trying to implement the technique described on the documentation page https://keras.io/preprocessing/image/ under the heading "Example of transforming images and masks together". After the following, image_generator =…
Rafael_Espericueta
  • 495
  • 1
  • 6
  • 14
0
votes
1 answer

Categorical image classification always predicts one class, though calculated accuracy reaches 100%

I followed the Keras cat/dog image classification tutorial Keras Image Classification tutorial and found similar results to the reported values. I then took the code from the first example in that tutorial Tutorial Example 1 code, slightly altered…
JG_Maine
  • 93
  • 1
  • 8
0
votes
1 answer

A custom alternating update rule with keras

I would like to use an alternating update rule with keras. I.e. per-batch I would like to call a regular gradient-based step, and next call a custom step. I thought about implementing it by either inheriting an optimizer or a callback (and use the…
Yuval Atzmon
  • 5,645
  • 3
  • 41
  • 74
0
votes
1 answer

Weighing a Tensor in Keras

I have a really simple issue that seems to have no built-in solution in Keras. Here' my problem: I have a (50,) dimensional tensor (layer 1's output) which is supposed to be multiplied to a (50, 49) dimensional tensor. These tensors are the output…
Rafael
  • 651
  • 13
  • 30
0
votes
1 answer

How can I create a model which is starts with a single convolution layer and then its output given to two different convolution layers

Can I generate a Model in keras which is not sequencial, i.e can I design a model with two train of cascaded convolution layer but the starting input is a common convolution output.
1 2 3
17
18