Skip to content
Advertisement

Tag: keras

Resize feature vector from neural network

I am trying to perform a task of approximation of two embeddings (textual and visual). For the visual embedding, I am using VGG as the encoder. The output is a 1×1000 embedding. For the textual encoder, I am using a Transformer to which output is shaped 1×712. What I want is to convert both these vectors to the same dimension

a bug for tf.keras.layers.TextVectorization when built from saved configs and weights

I have tried writing a python program to save tf.keras.layers.TextVectorization to disk and load it with the answer of How to save TextVectorization to disk in tensorflow?. The TextVectorization layer built from saved configs outputs a vector with wrong length when the arg output_sequence_length is not None and output_mode=’int’. For example, if I set output_sequence_length= 10, and output_mode=’int’, it is

What is meaning of separate ‘bias’ weights stored in Keras model?

Post-edit: Turns out I got confused while constantly playing with the three functions below. model.layer(i).get_weights() returns two separate arrays (without any tags) which are kernel and bias if bias exists in the model. model.get_weights() directly returns all the weights without any tags. model.weights returns weights and a bit of info such as name of the layer it belongs to and

ValueError: A `Concatenate` layer requires inputs with matching shapes except for the concat axis. Got inputs shapes: [(None, 36, 36, 128), etc

Any idea on what I’m missing? The exception comes up on u6 = concatenate([u6, c4]) I’m using python 3.9.1, my imports involve mainly Keras using a TensorFlow backend. I’ve also tried removing some of the MaxPooling, but that didn’t help, as well as changing some of the MaxPulling variables. My image input is: input_img = Input((300, 300, 1), name=”img”) Answer

How to set a breakpoint inside a custom metric function in keras

I am trying to write my own custom metric functions in keras and I wanted to start with a test function so I implemented a f1_score function using sklearn, next I will need to customize the calculation of the metrics according to my evaluation metrics and therefore I want to set a breakpoint inside the custom metric function to further

Error related to the number of input tensors in Keras

I am inputting series of float32 grayscale images as a list with 16*16 shape to python and try do a regression task with labels inputted from Pandas data frame. Here is the shape of images and df: I used train_test_split from sklearn to split the data to train and test: I am using the following model for doing the prediction,

Advertisement