Category "keras"

Keras early stopping callback error, val_loss metric not available

I am training a Keras (Tensorflow backend, Python, on MacBook) and am getting an error in the early stopping callback in fit_generator function. The error is a

regularizer causes "ValueError: Shapes must be equal rank"

When trying to run import numpy as np import keras X = np.ones((100,20)) Y1 = np.ones((100,5)) Y2 = np.ones((100,4)) Input_1= keras.layers.Input(shape=X.shape

Audio resampling layer for tensorflow

It is required to resample audio signals within a custom model structure. This resampling task is not a kind of pre/post-processing operation that can be develo

how to plot input and output shapes on top of each other using polt_model in keras

I want to plot my model using Keras.utils.plot_model function. my problem is that when I plot the model, the input and output shapes do not place on top of each

How to speed up Tensorflow 2 keras model for inference?

So there's a big update nowadays, moving from TensorFlow 1.X to 2.X. In TF 1.X I got use to a pipeline which helped me to push my keras model to production. Th

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