Category : tf.keras

i’ve got a Custom TensorFlow Dataset and my problem is , that my Validation Dataset is loading indefinitely, if i try to access the first item. So next(iter(train_ds.take(1))) returns the first Training-Data as expected, but next(iter(val_ds.take(1))) loads indefinitely. My Dataset Contains multiple Image-Path-Triplets (<ZipDataset shapes: ((), (), ()), types: (tf.string, tf.string, tf.string)>). My-Preprocessing looks something ..

Read more

I’m new to Keras and am encountering a dimensionality issue when trying to construct an autoencoder. The encoder has input images of shape (None,28,28,1) and uses pooling + flattening to give an output shape (None,49); this is then passed straight to the decoder, which begins with the following: dec_input = Input(shape=(49,)) reshape_vec = Reshape((7,7,1,))(dec_input) There’s ..

Read more

According to the demo code "Image similarity estimation using a Siamese Network with a contrastive loss" https://keras.io/examples/vision/siamese_contrastive/ I’m trying to save model by model.save to h5 or hdf5; however, after I used load_model (even tried load_weights) it showed error message for : unknown opcode Have done googling job which all tells me it’s python version ..

Read more

I am building a named entity recognition model. After doing the preprocessing (tokenization, padding and separation in modeling and validation set) I have an error when training the model. From what I understand the error is due to the dimensions of the training and test sets. my model is the following model = tf.keras.Sequential([ tf.keras.layers.Embedding(input_dim=2109,output_dim=64), ..

Read more

I’ve implemented a custom callback to stop training when the results change sufficiently little. It’s a bit more complicated than just accuracy or loss, so I can’t use the builtin EarlyStopping callback. Here’s a minimal example: from tensorflow import keras as k (x_train, _), (_, _) = k.datasets.mnist.load_data() x_train = x_train.reshape(x_train.shape[0], -1).astype(float) x_train /= 255 ..

Read more

i have created a simple classification model using keras sublcassing approach , where in the init function i addded batchnorm layer of keras.layers api. i am also using custom fit method where i have altered train step and test step providing a custom loss function. While training i am sving the model using keras "ModelCheckpoint" ..

Read more

I am working on Semantic segmentation using U-net and I’m trying to augment training data using ImageDataGenerator. There is one parameter whose effect I don’t completely understand – the parameter rounds in the .fit part shown below in the code. I have checked the Keras documentation (https://www.tensorflow.org/api_docs/python/tf/keras/preprocessing/image/ImageDataGenerator#fit) and it says that rounds parameter does the ..

Read more