Category "keras"

How to reset the state of an LSTM RNN after each epoch within Keras?

I have defined a stateful LSTM RNN, and I want to reset the state of the RNN after each epoch. I have found that one way to do this would be: n_epochs = 50 for

How does one invert an encoded prediction in Keras for model serving?

I have a Keras model in which i have successfully added a StringLookUp pre-processing step as part of the model definition. This is generally a good practice be

NotImplementedError: Cannot convert a symbolic Tensor (2nd_target:0) to a numpy array

I try to pass 2 loss functions to a model as Keras allows that. loss: String (name of objective function) or objective function or Loss instance. See losses. I

How to insert dropout layers after activation layers in a pre-trained non-sequential model using functional keras API?

I am working on a modified resnet, and want to insert dropout after activation layers. I have tried the following but due to the model not being sequential, it

TypeError: <lambda>() got an unexpected keyword argument 'dtype' with keras

I am running ANFIS algorithm on iris dataset. While adding fuzzylayer to the model i am getting error like below: TypeError: <lambda>() got an unexpected

Model.fit() Validation Accuracy different than Model.predict()

I have created a CNN to do binary classification in keras with the following code: def neural_network(): classifier = Sequential() # Adding a first convolu

Error while importing VGG16 h5 file ValueError: No model found in config file

I tried to import vgg16 which I downloaded from google storage import keras import cv2 from keras.models import Sequential, load_model But I got th

How should the output of my embedding layer look? Keras to PyTorch

I am in the process of translating a Keras implementation to a PyTorch one. After the full conversion my model was not converging fast enough, although the loss

use part of Keras Sequential model to predict

In the following code I have defined a Sequential model, that contains two parts conv_encoder and conv_decoder. After training the model I want to use conv_enco

In keras/ tensorflow, Is there a way to add a preprocessing layer to the output, similar to TargetTransformRegressor in sklearn?

I want to use keras to build a neural network regression model from X_train -> Y_train. In this example, however, I need to perform a preprocessing transform

No dimension mismatch for Keras sequential model?

I created a sequential neural network with Keras that has an input of 4 and an output of 8. I realize what I did was incorrect but I'm not sure as to why the co

How to do atrous convolution in tensorflow 2 (tf.keras)

I am trying to convert some code from tensorflow 1.x to tensorflow 2.x. It's been going well so far, but I'm stuck on atrous convolution. Unlike other layers, t

Input 0 of layer "conv2d_transpose_4" is incompatible with the layer: expected ndim=4, found ndim=2. Full shape received: (None, 100)

I am trying to develop a GAN, I have created the generator and the discriminator and now I am trying to train it. I am using the Mnist dataset but I plan to use

How to fix LSTM Layer Error - Image Classification

Currently I'm working on an image classification issue and created the following code based on a tutorial online - Image Classification using Keras. The code w

Using datagen.flow_from_directory with image segmination and number of classes

I used "flow_from_directory" but my "lose" is not decreasing. I notice When I run "fit_generator". Its says there is 1 classes, even though my mask have 3 class

Keras: difference of InputLayer and Input

I made a model using Keras with Tensorflow. I use Inputlayer with these lines of code: img1 = tf.placeholder(tf.float32, shape=(None, img_width, img_heigh, i

Keras LSTM fit underfitting

I have time series training data of about 5000 numbers. For each 100 numbers, I am trying to predict the 101st. At the end of the series, I would put in the pre

assertion failed: [Condition x == y did not hold element-wise:]

I have built a BiLSTM model with an attention layer for sentence classification task but I am getting an error that my assertion has failed due to mismatch in n

Incremental learning in keras

I am looking for a keras equivalent of scikit-learn's partial_fit : https://scikit-learn.org/0.15/modules/scaling_strategies.html#incremental-learning for incre

ValueError: logits and labels must have the same shape ((None, 328, 328, 3) vs (None, 1)) with autoencoder

I am trying to build an autoencoder with the following code import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns import