I am trying to train the mnist dataset on ResNet50 using the Keras library. The shape of mnist is (28, 28, 1) however resnet50 required the shape to be (32, 32, 3) How can I convert the mnist dataset to the required shape? Answer You need to resize the MNIST data set. Note that minimum size actually depends on the
Tag: keras
Why is Keras complaining about incompatible input shape in this case?
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
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
How to get iou of single class in keras semantic segmentation?
I am using the Image segmentation guide by fchollet to perform semantic segmentation. I have attempted modifying the guide to suit my dataset by labelling the 8-bit img mask values into 1 and 2 like in the Oxford Pets dataset. (which will be subtracted to 0 and 1 in class OxfordPets(keras.utils.Sequence):) Question is how do I get the IoU metric
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
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
how to use more three channels input in train_datagen
I am trying to apply Keras for images with more than three spectral channels. I noticed that train_datagen handles images with three channels based on color_mode=’rgb’. Is there any way to increase the number input channels or are there any alternative methods? Answer You can have 1, 3 or 4 channels. See the docs. color_mode One of “grayscale”, “rgb”, “rgba”.
TensorFlow CNN Incompatible Shapes: 4D input shape
I have sample data in the form: Data[n][31][31][5][2] with: “[n]” being the sample “[31][31]” being the array of data points “[5]” being the number of bits within that data point and “[2]” being one-hot encoding of the bits (eg a bit of 1 would be [1, 0] and a zero [0, 1]) The output is intended to either be a