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.

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 to your question since it has the same API.

gives you the power and flexibility of Keras within TensorFlow (see the docs with a lot of examples). The API of is described here

1494 questions
-1
votes
0 answers

How to solve a keras classifier training error?

WARNING:tensorflow:Your input ran out of data; interrupting training. Make sure that your dataset or generator can generate at least steps_per_epoch * epochs batches (in this case, 501900 batches). You may need to use the repeat() function when…
-1
votes
1 answer

What is the extra set of parenthesis outside of the parentheses for creating a layer object in Python / Keras?

I am trying to figure out how to use Keras and came across some syntax I'm not familiar with and don't know what to search for. I figured it would be easier to just show someone. What is going on with the last part of lines 2, 3, and 4? I'm asking…
Shane P
  • 3
  • 4
-1
votes
1 answer

What is the difference between keras.layer()(x) and keras.layer(x) in the functional API of keras?

I was wondering what the difference is between doing something like dense = Dense(64) x = dense(input) and this dense = Dense(64)(input) Are these two notations equivalent?
Olli
  • 173
  • 1
  • 8
-1
votes
1 answer

How can I create a custom keras optimizer?

I'm working on comparing the performances of SVRG, SAG and other optimizers for deep learning minimization. How can I implement custom optimizers with keras, I tried looking at the SGD keras implementation here source code but couldn't find the…
Nawel
  • 9
  • 4
-1
votes
2 answers

TensorFlow Binary Classification

I'm trying to make a simple binary image classification with TensorFlow, but the results are just all over the place. The classifier is supposed to check whether my gate is open or closed. I already have some python scripts to rotate and crop the…
-1
votes
1 answer

Function to build Keras model with arbitrary number of layers

I want to see what happens to my model when I vary the number of layers it has. I wrote a function to build, compile and fit a model with a custom number of layers. But it keeps making a (seemingly) identical model each time built with (what looks…
Adam Murphy
  • 304
  • 3
  • 10
-1
votes
1 answer

How to detect tf/keras model objects automatically

I'm working on supporting automatic model detection/logging for Keras/Tensorflow models for our Machine learning platform https://iko.ai and I have some questions: What are the different ways we can define a tf/keras model…
Haroun Mohammedi
  • 2,104
  • 9
  • 22
-1
votes
1 answer

In tensorflow understanding pipeline what is use of take(1) in 'for feature_batch, label_batch in train_ds.take(1)'

I have started to learn tensorflow to increase my machine learning skills. In tensorflow understanding pipeline what is use of take(1) in for feature_batch, label_batch in train_ds.take(1)
-1
votes
1 answer

Is it possible in TF/Keras to save the best model AFTER X epochs?

My models run really fast but they seem to slow down because I'm saving the best model (to load in another process); but I'm noticing the saving process itself slows down the processing. As in the early stages of the fitting each iteration is…
Lostsoul
  • 21,503
  • 39
  • 122
  • 205
-1
votes
1 answer

why did i got 2 different losses for sparse_categorical_crossentropy and categorical_crossentropy?

I trained a model for multiclass classification. There were three classes. In the first approach, I trained a model by converting the classes into one-hot vectors and training a model with loss function, categorical crossentropy, I achieved a loss…
-1
votes
1 answer

Keras ValueError: logits and labels must have the same shape ((None, 32, 17) vs (None, 17))

I am training a multi-label classifier(handwritten digit recogniser on IAM dataset). Here are shapes of all of my splits: >>> X_train.shape, X_val.shape, X_test.shape, Y_train.shape, Y_val.shape, Y_test.shape ((86583, 32, 128, 1), (4558, 32, 128,…
Naveen Kumar
  • 929
  • 8
  • 25
-1
votes
1 answer

Is it possible to override the progress bar of TensorFlow's keras?

In the last days, I have been observing a weird behavior in the printed loss in the progress bar. It turned out that the weird behaviour was due to the fact that the default progress bar of keras displays a moving average of the losses (rather than…
nbro
  • 12,226
  • 19
  • 85
  • 163
-1
votes
1 answer

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 class). Model model =…
Ludvig W
  • 664
  • 6
  • 23
-1
votes
1 answer

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) # Shape = (26, 6) model =…
-1
votes
1 answer

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 2 3
99
100