42,154 questions
1
vote
2
answers
99
views
getting a tensor of shape (32,) instead of a single value as a label
when i try to print/plt.tile the label of an image, its printing the tensor(32,) instead of a single label value. When i tried to print before the resizing, it was printing fine.
Code:
####
# ...
1
vote
0
answers
32
views
what is the purpose of training=True argument? Is it an argument of keras.sequential() or not? [duplicate]
What is the purpose of training=True argument in the last line. I called help(tf.keras.Sequential) but could not find anything related to it. Also is it the argument of tf.keras.Sequential() or not
...
1
vote
1
answer
39
views
TensorFlow Custom Training Loop with Mixed Precision Causing NaN Loss After Epoch 15
I am implementing a custom training loop in TensorFlow 2.18 with mixed precision (float16) for a large vision transformer model. The training runs fine for about 15 epochs, but then the loss suddenly ...
1
vote
0
answers
150
views
Training a 3D medical Image Segmentation is So Slow on NVIDIA Quadro RTX 8000 [closed]
I am training Swin-Unetr model on a 3D segementation dataset with patches of size (96,96,96,4) (depth,height,width,channels). My machine specs is as follows:
RAM Size: 128 GB
GPU: NVIDIA Quadro RTX ...
0
votes
0
answers
75
views
Tensorboard doesn't show weights for each layer
I'm trying to use tensorboard to monitor weights and bias of a two inputs neural network, composed by two independent submodels. I'm using keras==3.11.3 with tensorboard==2.20.0 and this is callback I'...
2
votes
0
answers
54
views
Write_grads no more present on latest version of Keras
I'm having some issues with the training of a convolutional neural network, as the loss initially decreases but suddenly it becames nan. I guess the problem could be related to some exploding/...
1
vote
1
answer
38
views
Do I need .repeat() or steps_per_epoch when training on a finite TFRecord dataset in Keras?
I’m following this tutorial on 3D brain tumor segmentation using MedicAI and Keras
In the tutorial:
dataset = dataset.batch(batch_size).prefetch(tf.data.AUTOTUNE)
The author does not use .repeat(...
1
vote
0
answers
43
views
Can I convert .keras model to .h5 so that tensorflow 2.10 can use it for prediction?
I trained a keras sequential model while working in colab. Now I shifted to a PC with Windows 11. jupyter notebook with Tensorflow 2.10 is unable to read that model. it needs a model in the old .h5 ...
0
votes
2
answers
46
views
Tensorflow gradient returns None
I am being implementing a custom layer that returns both the transformed output and an auxiliary loss term. The forward pass works fine, but when I try to compute gradients, I get None for the main ...
1
vote
0
answers
100
views
Unable to load an hdf5 model file in TensorFlow / Keras
I was given an hdf5 model file that was build with tensorflow / keras. Training data is no more available.
Note: all Python code snippets shown hereunder are run against Python 3.9.23 inside a ...
0
votes
1
answer
97
views
ValueError: Only instances of keras.Layer can be added to a Sequential model when using TensorFlow Hub KerasLayer
I’m trying to build a Keras Sequential model using a feature extractor from TensorFlow Hub, but I’m running into this error:
ValueError: Only instances of `keras.Layer` can be added to a Sequential ...
2
votes
1
answer
113
views
Keras Model throwing Error while integrating with frontend
I trained a model on Colab for my final year project EfficientNetB0. After all the layer training, I tested it and its result was excellent, but now I want to integrate the model to the frontend web ...
3
votes
0
answers
73
views
Multimodel for image captioning with CNN and LSTM over flickr30k does not learn. How to fuse image features and word embeddings?
I'm working on an image captioning project using a simple CNN + LSTM architecture, as required by the course I'm studying. The full code is available here on GitHub (note: some parts are memory-...
1
vote
1
answer
63
views
Mask image in tensorflow
Can I use keras.Layers to build custom layer to mask to whole dataset and return masked dataset. That is
class AttnMask(Layer):
def __init__(self, img_size, attention_map):
super()....
0
votes
0
answers
76
views
How to load a model while ignoring unbuilt head layers? (`expected 2 variables, received 0`)
I’m loading a costume ViT backbone saved via MLflow’s TensorFlow flavor (Keras 3). The artifact includes backbone parts I want (patch_embed, encoder) a couple of layers in the encoder were saved in a ...