Questions tagged [tf.keras]
[tf.keras] is TensorFlow's implementation of the Keras API specification. Use the tag for questions specific to this TensorFlow module. You might also add the tag [keras] to your question since it has the same API.
tf.keras
2,191
questions
-1
votes
1
answer
54
views
Keras LSTM model
I cannot find a hands on tutorial on how to structure the data for use with keras LSTM.
Data
x_train = 7300 rows where each vector is length 64.
y_train = array of 7300 items either 0's or 1's (the ...
-1
votes
1
answer
179
views
Why model's loss is always revolving around 1 in every epoch?
During training, loss of my model is revolving around "1". It is not converging.
I tried various optimizer but it still showing the same pattern. I am using keras with tensorflow backend. What could ...
-1
votes
1
answer
307
views
Running Keras MNIST example on Ubuntu 18.04 - GPU error
I was running the following Keras/TensorFlow code code after setting up Anaconda 2018.12 on Ubuntu 18.04. I have Nvidia driver 390.116 and have a GTX 1070 GPU. However, when I try to run this simple ...
-1
votes
0
answers
26
views
I have trained an image classifier using Tensorflow, but while loading its weights afterwards, I get an error
I have tried it with multiple frameworks be it VGG, Resnet, ConvNext. But i'm getting the same error.
While training the model, there are no problems. It even evaluates the model flawlessly. But if I ...
-1
votes
0
answers
98
views
module 'tree' has no attribute 'flatten'
I implore you to help me crack this nagging problem.
I’ve been trying to gain insight into ML using keras 3.0.5 on tensorflow 2.16.1 on python 3.12 on Windows 8.1.
To aid my understanding, I copied ...
-1
votes
1
answer
23
views
How to create a Keras CNN model that allows me to classify three things using tensorflow VGG-16 Model on Google Colaboratory
I see on Tensorflow (which is what I am using) that there are multiple ways to create such a program, however, everything I see does not show how to input the variables. How do I do that and where can ...
-1
votes
1
answer
74
views
Not able to train the model in server (Graph execution error:)
I am trying to train a V-Net model for CBCT dataset using Keras (tensorflow) library. But my local server is not able to train it. It is showing error. Please, somebody, help me in solving this issue.
...
-1
votes
1
answer
143
views
Difference between tf.Module and tf.keras.Model
I know both tf.Module and tf.keras.Model are used for building custom models.
But what's the difference between both of them?
Which one should be used when becuase there usage looks similar as shown ...
-1
votes
1
answer
50
views
Need help in creating a simple ml model using keras
i am trying to create model to predict spending score of this ( 200 rows- i am giving first few )
I have used one hot encoding , then use minmaxscalar in a for loop to scale each column separately, ...
-1
votes
1
answer
89
views
How can I put new input in the middle of the layers in Keras?
This model is what I want to implement. When the teacher model gets a sentence, it will output values that give more weight to important words for classification (e.g When the sentence is "I want ...
-1
votes
1
answer
324
views
Tensorflow ValueError: No gradients provided for any variable:
I was trying to do a custom loss function but I get the error.
This is supposed to be cyclegan for text
This is the loss function:
def sloss(ytrue, ypred):
nump = 0
print(nump)
for i in range(...
-1
votes
1
answer
87
views
loss value deep learning model is inf
I train a RNN deep learning model as bellow:
model = Sequential()
initializer = tf.keras.initializers.RandomNormal(mean=.5, stddev=1)
model.add(LSTM(512, return_sequences=True, dropout=0.2,input_shape=...
-1
votes
1
answer
144
views
Tensorflow / Tensorboard missing output from one of hparams during profiling
TF / TB running a profile with the following setup :
HP_NUM_NODES_ONE = hp.HParam('nodes_one', hp.Discrete([128]))
HP_NUM_NODES_TWO = hp.HParam('nodes_two', hp.Discrete([64, 128, 256]))
...
-1
votes
1
answer
145
views
Long waiting when running training model with ML
I have trouble for long waiting when I run my training model with Machine Learning using CNNs. Maybe this because my pc has such a bad specs for machine learning.
I have 50000 images for my X_training ...
-1
votes
1
answer
102
views
Overfitting on my model classification images CNN [closed]
I tried a lot to make a change in my validation accuracy by adding layers and dropout but still, I have no change yet my accuracy is upper than 95% and my validation accuracy is always stuck in 88%.
...
-1
votes
1
answer
35
views
Running into errors while implementing model in keras [duplicate]
I am not able to create the model in Keras as I am running into some errors. Please help
Error while implementing model
-1
votes
1
answer
227
views
How to sort read files by using ImageDataGenerator
enter image description here
enter image description here
I have a trouble in loading images with DataGenerator. It's not sort like my real path as you can see from images. It should be like img(1), ...
-1
votes
1
answer
828
views
tf.keras.layers.concatenate throws a "SyntaxError: invalid syntax"
I'm trying to run the following got, but I'm getting a syntax error:
from keras.layers import Input
from keras.layers import Concatenate, Dense, LSTM, Input, concatenate
nlp_input = Input(shape=(...
-1
votes
1
answer
303
views
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.weights
model.get_weights()
model.layer(i).get_weights()
model.layer(i).get_weights() returns two ...
-1
votes
1
answer
388
views
Is there a way to find the average precision and recall of each class in the custom Tensorflow model?
I have trained a model using TensorFlow and SSD MobileNet. I was able to find the mean average precision of the model. Is their a way to find the average precision of each class in the models.
I am ...
-1
votes
1
answer
933
views
TypeError: 'tuple' object is not callable?
I am trying to plot the Model accuracy and Model loss learning curves after I have successfully trained my LSTM model to see the pattern of the learning curves (to see if its overfitting or ...
-1
votes
1
answer
714
views
Image Data generating for data augmentation
I am working on image classification by transfer learning in the 12 several classes of the dataset. However, I am facing overfitting. As a result, I applied data augmentation (Maybe flying) for ...
-1
votes
2
answers
92
views
Keras functional API: My model is only optimizing for one loss function instead of 2 loss functions while training
I have 2 loss functions in my model - Cross Entropy and Mean Squared.
I want my model to minimize both the losses but the model is only minimizing mean squared error during training.
def ...
-1
votes
1
answer
1k
views
ValueError: Error when checking input: expected dense_input to have shape (46,) but got array with shape (1,)
This is not my code I just tried changing the neural networks part and the problems started there,
What am I doing wrong?
training = np.array(training) # Shape = (46, 26)
output = np.array(output) ...
-1
votes
1
answer
53
views
AttributeError: It says builtin_function_or_method has no attribution"shape", but it's not
inputs = tf.keras.Input(shape=(4,4,12))
layer = tf.keras.layers.Conv2D(filters=FILTERS1+FILTERS2+FILTERS3, kernel_size=(2,2),
padding="same", activation=None,
...
-1
votes
1
answer
29
views
Is there any library to build generators for keras.Model.fit_generator?
keras.preprocessing.image.ImageDataGenerator is used create Generators for Image input.
Is there any similar kind of library available for normal numpy array input?
-1
votes
1
answer
784
views
Why is my neural network always giving me the same predictions?
I'm trying to create a sequential neural network where the output is 12 non-exclusive probabilities ( probability of A, probability of B, probability of C, ... ). My network seems to learn the most ...
-2
votes
1
answer
42
views
Loss-epoch curve looks weird. How to improve multiclass classification model?
I'm training a set of images using MobileNet that would do multiclass classification. After training loss-epoch curve spikes towards the end
I'm not sure how to interpret this, if this is good enough/...
-2
votes
1
answer
1k
views
How to load a model with tf.keras?
import tensorflow as tf Tensorflow 2.0
i saw that i can load a model from tensorflow like this
image_model = tf.keras.applications.MobileNet(include_top=True, weights='imagenet', pooling='avg')
...
-2
votes
1
answer
48
views
Why is my loss function value increasing with each epoch?
I have a multiclass classification problem and would like to train a neural network model. I am using TensorFlow and Keras. This is the dataset link.
There are 7 different target labels. I have been ...
-2
votes
1
answer
283
views
how to detect not in trained-for-category images when using resnet50
I have trained resnet50 on four categories of images. It works fantastic when I feed it an image in any one of the four categories -- I have essentially 100% accuracy on images in these categories.
...
-2
votes
1
answer
440
views
AttributeError: module 'keras.engine.sequential' has no attribute 'add'
AttributeError: module 'keras.engine.sequential' has no attribute 'add'
I am working on an image classification in this a problem keras.engine.sequential has no attribute add
-2
votes
1
answer
158
views
What should be the input-shape number when i am adding the input layer in my ANN, considering that I have preprocessed the data with OneHotEncoder?
My dataset has categorical and numerical features. The dataset has 7 independent variables and 1 dependent variable (called as a product). The dataset looks like this:
In general, there are 3 ...
-2
votes
2
answers
366
views
how to design a custom loss function to add two loss
I am using CNN to solve a regression problem in a supervised manner. i have input data(X_train) and the target data(y_train).
-3
votes
1
answer
54
views
Undefined Variable in Class Lambda Function
When in the IDE I get the error:
"normalization_layer" is not defined
I tried the following code
AUTOTUNE = tf.data.AUTOTUNE
train_ds = train_ds.cache().shuffle(1000).prefetch(buffer_size=...
-3
votes
1
answer
244
views
Difference between Model(inputs=[input],outputs=[output1,output2]) and Model(inputs=[input],outputs=[output1]+output2) in KERAS?
Please check out the last line of the code
-3
votes
1
answer
140
views
How to increase Emotion Detection Validation Accuracy on VGG16 model ? [Transfer Learning]
import pandas as pd
import numpy as np
import keras
import tensorflow
from keras.models import Model
from keras.layers import Dense
from keras import optimizers
from keras.preprocessing.image import ...
-3
votes
1
answer
107
views
TensorFlow 2.4.0 - Parameters associated with BatchNorm and Activation
I am printing a tensorflow.keras.Model instance summary. The type is tensorflow.python.keras.engine.functional.Functional object.
This model has layers with activations and batch normalization ...
-4
votes
1
answer
339
views
Why doesn't my CNN validation accuracy increase? [closed]
I am attempting to create a simple CNN to be able to distinguish eye (retinal) scans of different severities. It is a multi-class classification problem, 5 classes. This by now is probably a fairly ...