I have trained a Keras-based autoencoder model with the following input layer: Width and height of my training images were 100 pixels in grayscale, thus with a depth of 1. Now I want to load my trained model in another script, load an image there, resize and send it to the Keras model: However, the call to autoencoder.predict(image) leads to
Tag: tensorflow
How to use tf.keras.utils.Sequence with model.fit() in Tensorflow 2?
I want to train a model with a custom generator class but model.fit() gives me this error: Here is the DataGenerator class I wrote: And here is the model I want to train on the DataGenerator class: The code seems correct but I get the error despite many tries. How to use tf.keras.utils.Sequence with model.fit() in Tensorflow 2? Answer Because
How to train a Keras autoencoder with custom dataset?
I am reading this tutorial in order to create my own autoencoder based on Keras. I followed the tutorial step by step, the only difference is that I want to train the model using my own images data set. So I changed/added the following code: My images are normal .jpg files in RGB format. However, as soon as training starts
Traing a CNN using Prelu activation function
I’m trying to train the model using prelu activation function, but I get the following error I’m using the below-mentioned code, kindly let me know how do I correct it. Answer Your tensor input is wrong. You need to set it up like this way Full working code
ValueError: Object arrays cannot be loaded when allow_pickle=False
I tried to get solution for this code , hoping for a positive response output: Please let me know the solution for this Answer Try
Concatenating empty array in Tensorflow
So basically, my question is the same as Concatenating empty array in Numpy but for Tensorflow. Mainly, the motivation is to handle the initial array in a prettier way that using a if statement. My current pseudo-code is: This technique works but I would like to make it a prettier way and maybe using only tf.Tensor. This is a code
Invalid argument: Dimension -972891 must be >= 0
I have created a data pipeline using tf.data for speech recognition using the following code snippets: These snippets are borrowed from https://www.tensorflow.org/tutorials/audio/simple_audio#build_and_train_the_model. And my model is defined as below: When I start training process this error appears after a few iterations: Answer I have found that the issue happened in the padding step, I mean I’ve replaced the padding step
LSTM neural network test to predict SPY prices giving me this error after training
Error is as follows: My Code is as follows: Not sure what’s going on…. Answer Just check you train dataset, there is no Open column there, so dataset_train[‘Open’] fails: Output: Maybe you want to use dataset_train[‘Value’] instead
Training a single model jointly over multiple datasets in tensorflow
I want to train a single variational autoencoder model or even a standard autoencoder over many datasets jointly (e.g. mnist, cifar, svhn, etc. where all the images in the datasets are resized to be the same input shape). Here is the VAE tutorial in tensorflow which I am using as a starting point: https://www.tensorflow.org/tutorials/generative/cvae. For training the model, I would
If-Else Statement in Custom Training Loop in Tensorflow
I created a model class which is a subclass of keras.Model. While training the model, I want to change the weights of the loss functions after some epochs. In order to do that I created boolean variables to my model indicating that the model should start training with additional loss function. I add a pseudo code that mainly shows what