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
1 answer

Local output of Keras cost is nan but colab output of Keras cost is valid

I was trying a neural network on the cifar-10 dataset but the training outputted nan for the cost of the model on the first epoch when I was using my GTX 1650 for laptop. I tried to normalize the data with tf.keras.layers.Normalization with mean 0…
Hi There
  • 1,827
  • 2
  • 6
  • 9
0
votes
1 answer

How to make multi-inputs and multi-outputs neural network model

I converted the following code from Keras to Pytorch. The main challenge here for me is to make multi-inputs and multi-outputs model similar to keras.models.Model. As how to implement the following code, in Pytorch, to accept the multi input and…
Dalek
  • 4,168
  • 11
  • 48
  • 100
0
votes
1 answer

keras sequential TypeError: object of type 'NoneType' has no len()

I was trying to created a simple model, wrapped in keras wrapper. When I test it with simple input, I get the TypeError: object of type 'NoneType' has no len(). I was using scikeras wrapper. Also, the error is because of the wrapper, not exatly sure…
tjt
  • 620
  • 2
  • 7
  • 17
0
votes
1 answer

Is it possible to convert a TensorFlow (Keras) model from BGR to RGB?

I have converted a Caffe model, learned on BGR data, to ONNX format and then from ONNX to TensorFlow (Keras) So now I have a Keras model, learned on BGR data. Is it possible to convert it in such a way, that it will properly work with RGB data? I've…
0
votes
1 answer

preprocess_input changes array inplace, but doesn't change tensor

I've noticed some strange behaviour in preprocess_input, a function used to preprocess images to normalise values correctly for the specific pre-trained network you are using. After several hours of debugging, it appears that when a tensor is used…
gnoodle
  • 149
  • 9
0
votes
1 answer

How to get shapes of all the layers in a model?

Consider the following model def create_model(): x_1=tf.Variable(24) bias_initializer = tf.keras.initializers.HeNormal() model = Sequential() model.add(Conv2D(64, (5, 5), input_shape=(28,28,1),activation="relu", name='conv2d_1',…
0
votes
0 answers

Continue training CNN model to improve recognition resilience

I have a CNN model that performs well on a training set, but when I extend it to my "production" data, the performance is lagging. The reason that I cannot use my "production" data for training purposes is that it is not tagged with the requisite…
C. Cooney
  • 471
  • 5
  • 19
0
votes
1 answer

How to solve problem of : Graph disconnected: cannot obtain value for tensor Tensor?

I am trying to code a deep neural network but I am getting the following error: ValueError: Graph disconnected: cannot obtain value for tensor Tensor("input_1:0", shape=(None, 256, 256, 3), dtype=float32) at layer "conv2d". The following previous…
0
votes
1 answer

Keras save model with named layers

I have a keras model where each layer has a specific name def build_model(): input_layer = keras.Input(shape=input_shape, name='input') conv1 = layers.Conv2D(32, kernel_size=(3, 3), activation="relu", name='conv1')(input_layer) maxpool1 =…
0
votes
0 answers

Understanding Keras Layer Shape

My features/targets look like: x[0] = [10, 15, 13] y[0] = [1, 4] The numbers represent lookup indexes for words in english and french. Here's the shape of my input and training data: input: (137861, 15) training: (137861, 21) Here's the summary of…
0
votes
1 answer

After converting Tensorflow Model to CoreML, the model doesn't predict correct

I'm trying to convert a tensorflow model to CoreML model. Here is what I do import tensorflow as tf import coremltools as ct # copy paste the labels class_labels = [ 'label 1', ['label 2'] .. ['label n']] model =…
0
votes
0 answers

Why does my class-weighted model perform so strangely/bad?

Here are the accuracy and loss plots for the class-weighted version: Here are the accuracy and loss plots for the unweighted version: Here is the code. The only difference in the above two versions is that one calls the class weights dictionary…
brosefzai
  • 49
  • 5
0
votes
0 answers

InvalidArgumentError: Graph execution error- using keras

enter image description here getting error InvalidArgumentError: Graph execution error: while using model.fit. Please help
0
votes
0 answers

Trained model (in session) and save-load model results differ by huge margin (very high MAE in session trained model)

Problem: If I save and load model (ANN model) in the same session, the result from the loaded model is different to the model already in the session (prior to saving) Ideally shouldn’t a trained model (in session/memory) and loaded model (post save…
0
votes
1 answer

Val_loss "Nan" After Decreasing Sample Size in the CSV File but Processed Data Is the Same

I have tried the following example, which works very well. In the example file, the values are stored in 10-minute intervals. However, since I need to bring in more values that are just hourly available, I deleted from the database all values that…