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 for examples). The API of is described here.

References:

2208 questions
0
votes
2 answers

Saving Keras model with multiple outputs (The wrapped dictionary was modified outside the wrapper)

I have a multi-class classifier that I also want to query for the output of one of the intermediate layers. inputs = Input(...) ... fc = Dense(32, activation='relu', name='FC_1')(layer) x = Dense(num_cats, activation='softmax',…
rodrigo-silveira
  • 12,607
  • 11
  • 69
  • 123
0
votes
1 answer

Augmentation layers only for specific classes

For the classification task, I would like to apply Augmentation Layers (augmentation), only for specific classes. The rationale: In case of an unbalanced dataset I would like to improve model performance for classes with a small number of…
Michael D
  • 1,711
  • 4
  • 23
  • 38
0
votes
1 answer

How to give a sequece of numpy array as input to CNN

How can I reshape a sequence of arrays of shape (90,30,1662)? Meaning 90 arrays with 30 frames each and 1662 keypoints for each frames.And 90 array meaning 30 videos of numpy arrays for a word with 30 frames per video. x_train, x_test, y_train,…
0
votes
1 answer

How to slice a Keras tensor using the values from another tensor in Tensorflow 2.0?

I have a Keras tensor of feature maps of size (None, 256, 256, 128) obtained after convolution on input image of size (None, 256, 256, 3). The another input tensor (index tensor) is of size (None, 128) that contains integers from 0 to 127. I want to…
0
votes
0 answers

Tensorflow keras model.predict() fails

I am doing my machine learning project in Keras. I am using a k-fold cross-validation and later I am using the built-in model.predict(). model = tf.keras.Sequential() model.add(layers.Dense(w, input_dim=w,…
0
votes
2 answers

Trouble with setting the objective function in BayesianOptimization tuner in keras_tuner

I'm trying to tune hyperparameters for an LSTM model in Keras using Keras tuner's BayesianOptimization tuner. I keep getting error messages that seem to object to what I put in the objective argument when I instantiate the tuner. Here's my code: …
koiky71
  • 3
  • 2
0
votes
1 answer

AttributeError: module 'keras.api._v2.keras.metrics' has no attribute 'auc'

I am running this particular notebook from this link Chexpert Keras CNN, which is training cnn model on the chexpert dataset and with keras library. However I am getting this particular error when I am running this syntax. history =…
DDM
  • 303
  • 4
  • 19
0
votes
1 answer

Why the result of categorical cross entropy in tensorflow different from the definition?

I am testing outcomes of tf.keras.losses.CategoricalCrossEntropy, and it gives me values different from the definition. My understanding of cross entropy is: def ce_loss_def(y_true, y_pred): return tf.reduce_sum(-tf.math.multiply(y_true,…
EulersRealPie
  • 26
  • 1
  • 4
0
votes
0 answers

Conv1D layers on 1 dimensional data

I've seen many answers to this exact topic but i still couldn't figure out the solution to my case. Here is my model: class Model(tf.keras.Model): def __init__(self, hidden_nodes1, hidden_nodes2, hidden_nodes3): super().__init__(); …
0
votes
1 answer

Use ImageDataGenerator to load images from memory instead of disk for GPU processing

I am using the ImageDataGenerator to augment images for CNN model training train_data_gen = image_gen_train.flow_from_directory( batch_size=BATCH_SIZE, directory=train_dir, <-- here target_size=(IMG_SHAPE,IMG_SHAPE), shuffle=True, …
Centy
  • 61
  • 5
0
votes
0 answers

Keras - TypeError: Using a `tf.Tensor` as a Python `bool` is not allowed. OR ValueError: Please provide as model inputs either a single array

I'm a beginner with python and Keras and I've been trying to train a model for a few days now and I just can't get it to work. I'm trying to learn with code I found online, but applying it to a project I actually have use for. My data is a 1100 rows…
0
votes
1 answer

Keras Dense Model ValueError: logits and labels must have the same shape ((None, 200, 1) vs (None, 1, 1))

I'm new in machine learning and I'm trying to train a model. I'm using this Keras oficial example as a guide to set my dataset and feed it into the model: https://www.tensorflow.org/api_docs/python/tf/keras/utils/Sequence From the training data I…
0
votes
1 answer

ValueError: cannot reshape array of size 50176 into shape (7,7,512)

I am trying to train a model(by incorporating vgg16 in the encoder network of autoencoder) but the input shape requirement is(7,7,512) for the decoder network. While my data is in grayscale vgg16 requires 3 color channels so for this i've copied the…
user18148455
0
votes
1 answer

Intermediate Output of let' s say Resnet50 from Keras Model

import keras print(keras.__version__) #2.3.0 from keras.models import Sequential from keras.layers import Input, Dense,TimeDistributed from keras.models import Model model = Sequential() resnet = ResNet50(include_top = False, pooling = 'avg',…
user2458922
  • 1,691
  • 1
  • 17
  • 37
0
votes
0 answers

Proper way to add additional data to a tf.dataset using existing element information

I want to train a model that has two types of data, a multivariate time series part and a static (as in not changing over time) part corresponding to which of some 8,000 different sites the time series part comes from. To create windows on the time…
1 2 3
99
100