i have an import problem when executing my code: Keras version: 2.6.0 Tensorflow: 2.6.0 Python version: 3.9.7 The library it is installed also with Do you have any ideas? library path Answer You’re using outdated imports for tf.keras. Layers can now be imported directly from tensorflow.keras.layers:
Tag: keras
Gradient exploding problem in a graph neural network
I have a gradient exploding problem which I couldn’t solve after trying for several days. I implemented a custom message passing graph neural network in TensorFlow which is used to predict a continuous value from graph data. Each graph is associated with one target value. Each node of a graph is represented by a node attribute vector, and the edges
U-Net Semantic segmentation model fails when tested on new image
I have a U-Net model with pretrained weights from an Auto-encoder, The Auto-encoder was built an image dataset of 1400 images. I am trying to perform semantic segmentation with 1400 labelled images of a clinical dataset. The model performs well with an iou_score=0.97 on my test image dataset, but when I try to test it on a random image outside
ValueError: Dimensions must be equal, but are 96 and 256 in tpu on tensorflow
I am trying to create a mnist gan which will use tpu. I copied the gan code from here. Then i made some of my own modifications to run the code on tpu.for making changes i followed this tutorial which shows how to us tpu on tensorflow on tensorflow website. but thats not working and raising an error here is
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,