Questions tagged [keras-2]

with a new API.

Keras API will now become available directly as part of

264 questions
0
votes
1 answer

Error in removing the first layer of keras model

import numpy as np from keras.applications.vgg19 import decode_predictions from prettytable import PrettyTable import time from keras import backend as K from tensorflow import keras from tensorflow.python import keras from keras import models,…
user11549734
0
votes
1 answer

Keras stops after fit_generator with no error

I am playing around with Resnet architectures to compare performance with a CNN. I used this Resnet for my first test. I am reusing my code to load and prepare data for the network and it works just fine. The rest of the script seems to also work…
Robi Sen
  • 162
  • 1
  • 8
0
votes
2 answers

Migrate Convolutional2D dim_ordering parameter to Conv2D in tf.keras

I'm newbie with Tensorflow and Keras, and I'm migrating the following code: Convolution2D(64, 5, 5, activation='relu', border_mode='same', dim_ordering='tf', name='conv1_1')(inputs) The interpreter suggest me this code: Conv2D(64, (5, 5),…
VansFannel
  • 45,055
  • 107
  • 359
  • 626
0
votes
0 answers

Tensorflow 2.0 custom gradient function

I am trying to build a custom gradient for A piece-wise continuous function that I found in the paper A continuum among logarithmic, linear, and exponential functions, and its potential to improve generalization in neural networks - Godfrey Current…
zwep
  • 1,207
  • 12
  • 26
0
votes
1 answer

Keras fit_generator incorrect input shapes

I'm using an ImageDataGenerator to input batches of images to a neural network, but can't work out the correct way to feed it. Running the following: train_datagen = ImageDataGenerator(rescale=1./255, shear_range=0.2, zoom_range=0.2,…
0
votes
1 answer

Supressing the output when fitting a Keras model

I have designed a NN with Keras and the code after defining the model are the following: model.compile(optimizer= 'Adam',loss='mean_squared_error') ##callbacks cb_checkpoint = ModelCheckpoint("model.h5", monitor='val_loss',…
user8270077
  • 4,621
  • 17
  • 75
  • 140
0
votes
0 answers

How to should I divide the preprocessing arguments of Keras' ImageDataGenerator from the data augmentation arguments

I'm about to use Keras' ImageDataGenerator class (in keras/preprocessing/image.py) for training a neural net. I will have one generator for my training data, and another for my testing data. However, some of the arguments seem to apply to…
user1245262
  • 6,968
  • 8
  • 50
  • 77
0
votes
1 answer

how to use Merge in kerase>2.0?

word_model=Sequential() word_model.add(Embedding(vocab_size,embed_size, embeddings_initializer="glorot_uniform", input_length=1)) word_model.add(Reshape((embed_size,))) context_model=Sequential()…
wwwxinyu
  • 11
  • 3
0
votes
1 answer

Runtime Error : Session Graph is Empty. Add Operations to Graph

# Build a graph. a = tf.constant(5.0) b = tf.constant(6.0) c = a * b # Launch the graph in a session. sess = tf.compat.v1.Session() # Evaluate the tensor `c`. print(sess.run(c)) This above code is taken from tensorflow core r2.0 documentation But…
Krishna Rohith
  • 74
  • 1
  • 1
  • 11
0
votes
1 answer

Simple keras dense model freezes while fitting

I am learning NLP with Keras and I am going through a tutorial. The code is the following: import tensorflow_datasets as tfds imdb, info = tfds.load("imdb_reviews", with_info=True, as_supervised=True) import numpy as np train_data, test_data =…
user8270077
  • 4,621
  • 17
  • 75
  • 140
0
votes
0 answers

How to record training and validation loss after each batch rather than epoch in Keras, Tensorflow 2.0

I am training a model which takes a long time to complete an epoch and I would like to be able to record and monitor during training the training and validation loss after each batch rather than epoch. So currently this is what I get: My callbacks…
user8270077
  • 4,621
  • 17
  • 75
  • 140
0
votes
1 answer

How to append images to a list inside a Keras network

I would like to append the images which are procurred by the ImageDataGenerators to two different lists. I believed I could do that with a lambda layer but I am getting an error message. For a toy example see the code below. You can use any set…
0
votes
0 answers

Visualizing convoluational layers in autoencoder

I have built a variational autoencoder using 2D convolutions (Conv2D) in the encoder and decoder. I'm using Keras. In total I have 2 layers with 32 and 64 filters each and a a kernel size of 4x4 and stride 2x2 each. My input images are (64, 80, 1).…
machinery
  • 5,972
  • 12
  • 67
  • 118
0
votes
1 answer

Graph disconnected error when using skip connections in an autoencoder

I have implemented a simple variational autoencoder in Keras with 2 convolutional layers in the encoder and decoder. The code is shown below. Now, I have extended my implementation with two skip connections (similar to U-Net). The skip connections…
machinery
  • 5,972
  • 12
  • 67
  • 118
0
votes
1 answer

Padding in Conv2D gives wrong result?

I'm using the Conv2D method of Keras. In the documentation it is written that padding: one of "valid" or "same" (case-insensitive). Note that "same" is slightly inconsistent across backends with strides != 1, as described here As input I have…
machinery
  • 5,972
  • 12
  • 67
  • 118