Questions tagged [keras-layer]
1512 questions
-1
votes
3 answers
Keras Resizing layer not accepting different sized images as input
My understanding is that Keras' Resizing layer can take input images of different sizes, but I've been unable to get it to work. The following notebook shows the error:
import tensorflow as tf
import tensorflow_datasets as tfds
from…

Marquo
- 3
- 4
-1
votes
1 answer
Trainable weights in custom layers?
I was learning making custom layers in tensor flow but could not find out how to add trainable weights for example
class Linear(layers.Layer):
def __init__(self, units = 32, **kwargs):
super().__init__(kwargs)
self.units = units
def…

RajaParikshat
- 23
- 3
-1
votes
1 answer
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 underfitting) . The problem is the error "TypeError:…

Eilham Hakimie
- 1
- 1
-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
- 906
- 10
- 25
-1
votes
1 answer
Using dot product in keras
I went through a couple of stack overflow answers related to dot product, but could not find the answer to my issue.
I am creating a model with two parallel CNN which get different inputs. I am using a simple CNN with 1 convolution layer. I am using…

user1476747
- 1
- 1
- 2
- 3
-1
votes
1 answer
Accuracy value of 0 even after testing several loss functions
I want to predict price of:
X=dataset.iloc[:,1:12]
Y=dataset.iloc[:,0:1]
X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.3)
//this is my neural network
model=Sequential([
…

Abubakar
- 43
- 5
-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
- 744
- 8
- 27
-1
votes
1 answer
`save_model` requires h5py error occurss after installing h5py and cython packages too
I need to save my new sequential model but when I use the model.save(filename),it shows error like save_model requires hp5y.I tried installing h5py in conda by 'conda install -c anaconda h5py'command. And I also installed cython,but then the error…

Mythili
- 11
- 2
-1
votes
1 answer
How to shape images for labels
I am trying to train satellite images. My training set has 2 folders of input (samples) and ground truth (labels).
Total images are: 496
My X_train shape is: (496,3,256,256)
and y_train shape is: (496,256,256)
For every model, I use I get an error…
-1
votes
1 answer
Can I use BatchNornalization layer after a conv3d layer?
In keras.oi under BatchNormalization,
Arguments:
axis: Integer, the axis that should be normalized (typically the features axis). For instance, after a Conv2D layer with data_format="channels_first", set axis=1 in BatchNormalization.
Does it mean…

Xu Zhang
- 17
- 2
-1
votes
1 answer
How to change input shape of the model with lambda layer
Lets suppose I have specified mobilenet from keras models this way:
base_model = MobileNetV2(weights='imagenet', include_top=False, input_shape=(224, 224, 3))
# add a global spatial average pooling layer
x = base_model.output
x =…

Rocketq
- 5,423
- 23
- 75
- 126
-1
votes
2 answers
How do you know which layers and how many layers to use?
I am new to machine learning and have spent some time learning python. I have started to learn TensorFlow and Keras for machine learning and I literally have no clue nor any understanding of the process to make the model. How do you know which…

David
- 153
- 1
- 14
-1
votes
1 answer
how can i implement Gaussian noise attack in keras?
I try to implement the code of https://arxiv.org/abs/1810.07248 that is about watermarking using deep learning, but I need to apply some attacks like Gaussian noise during learning. I used GaussianNoise layer but it said it only used during…

david
- 1,255
- 4
- 13
- 26
-1
votes
1 answer
visualize the output of convolutional layer in autoencoder
I have a simple autoencoder and I want to see the output of each layer especially the latent space. I know that after each layer some features like edges achieved but I want to show the output of each layer. I want to know what is the output of each…

maedeh
- 105
- 2
- 10
-1
votes
1 answer
keras parametes for multilabel text classification
I am using keras in my multiclass text classifcation, the dataset contains 25000 arabic tweets with 10 class labels
I use this code :
model = Sequential()
model.add(Dense(512,…

Ahmed
- 23
- 5