Questions tagged [functional-api]
37 questions
1
vote
1 answer
How to print accuracy of different activation layers while training a Keras functional API model? (Tensorflow Python)
I have used the Functional API to create a model with three different output layers to test different activation functions. The problem is that the output line for each epoch is too long. I only want to look at the accuracy and not the loss.
Epoch…

Neil Lunavat
- 21
- 4
1
vote
1 answer
Bidirectional Layer: Dimension value must be integer or None or have an __index__ method, got value '1932.0' with type ''
It's my first time I work with Bidirectional layers, but I don't find any examples with the use of the functional API from Keras. mask_mastrix is a tensor with shape (samples, timesteps) with binary values True / False.
with strategy.scope():
…

DataPlanningEngineer
- 56
- 6
0
votes
0 answers
What input parameters should I use in Keras Functional API?
I am trying to write code for machine learning with Keras using Functional API. I am confused as to what input parameters to use.
# first input model
numbers_input = Input(shape=(,5,1))
conv11 = Conv2D(32, kernel_size=4,…

John
- 1
0
votes
0 answers
Using tf.TensorSpec as input shape for keras functional API
Given some TensorSpec or some tuple of TensorSpec's, is there a (simple) way to make a tf.keras.Inputs for some tf.keras.Model where the input has its shape specified in the TensorSpec ?
For example:
import tensorflow as tf
spec =…

Pierrotb1
- 50
- 6
0
votes
0 answers
GRAD-CAM: How to I extract the output of the intermediate layers for this shared weight model?
This is the siamese network model I built using keras siamese network implementation.
base_cnn = resnet.ResNet50(
weights="imagenet", input_shape=target_shape + (3,), include_top=False
)
flatten = layers.Flatten()(base_cnn.output)
#dense0 =…

Sawaiz Naseem
- 1
- 2
0
votes
0 answers
Fitting a multi input CNN using keras and TensorFlow with data generated using flow_images_from_dataframe
I am using keras and tensorflow in R to fit a CNN composed of multi-input layers. I have an image dataset composed of photos of the height and width of an object and I want to apply a regression model. I am creating the training sets using…

Pablo Fonseca
- 49
- 5
0
votes
0 answers
How to insert some layers into functional Resnet34 tensorflow model to create a new functional model?
I loaded pretrained Resnet34 model in tensorflow. I want to insert a rescaling layer after the input layer and before the batch normalization layer.
resnet34 summary architecture is as bellow (My Tensorflow version is 2.9.0):
I did that with this…

MediaJ
- 41
- 7
0
votes
1 answer
How do you write an input layer with Tensorflow's Functional API that expects a Dataset object?
I am trying to create an Input Layer using tf.keras.Input using the type_spec argument to specify an input of DatasetSpec using Tensorflow's Functional API so that I can iterate over it later. If I try to define an input layer by specifying shape, I…

Jezen_Volk
- 42
- 8
0
votes
1 answer
How do I explicitly split a Dataset tuple in Tensorflow's functional API into two separate layers from just one input layer?
Context
The input to my model is a BatchDataset object called dataset_train, and it is batched to yield (training_data, label).
For some of the machinery in my model, I need to be able to split the Dataset tuple inside the model and independently…

Jezen_Volk
- 42
- 8
0
votes
0 answers
ValueError: Graph disconnected: cannot obtain value for tensor KerasTensor
I am trying to connect the last layer of two UNet model using functional API and I am having the issue. I think error happens somewhere linking between input layer and each models but I have no clue where to fix.
data_input =…

dspeanut
- 13
- 3
0
votes
0 answers
Multi input Functional API CNN model
I am making multi input cnn model using keras functional api but it
is giving error... data:
trainset1 = trainset.flow_from_directory(
'/content/',
target_size=(404,410),
batch_size=32,
#seed=50,
class_mode='categorical')…
0
votes
1 answer
Low accuracy using functional API + CNN and CIFAR10; incorrect initialization?
I'm new to using CNNs but I'm trying to make one using the functional API with the CIFAR10 dataset. The only thing is I'm getting very very low accuracy. I've looked over my textbook examples and documentation but can't figure out why it's so low…

lusnu
- 1
0
votes
1 answer
Is there a way to get class labels when predicting a categorical target variable in Sequential or Functional API models?
I am currently building a neural network model using Keras' Functional API and a dataset with multiple independent variables and a single categorical target variable using the following code.
input_layer = keras.Input(shape=(89,),…

Daniel Coben
- 15
- 5
0
votes
1 answer
GridSearchCV, Pipeline and Functional Model
Problem with predict function of Functional Model
I am trying to combine, nested-cross validation and pipeline with my Functional Model.
This is the code:
binaryModel = is hereby a Functional ANN
grid = dict(ann__n_neurons=[2],…

Chrissi.k
- 1
- 1
0
votes
0 answers
Correct way to use custom rnn cells with multiple inputs
I'm trying to create a custom cell of a recurrent neural network model where the cell accepts 2 tensors as input. The rnn layer is then linked to a dense layer. The problem occurs when I use the second input to calculate the output. In fact, if I…

JayJona
- 469
- 1
- 16
- 41