Questions tagged [keras-layer]
1512 questions
0
votes
0 answers
Use Multi-layer Keras Model as Convolution Filter
I have a two layer bidirectional recurrent stack in the final layer of an existing model that is trained to extract text from images of constant size. I am adding an additional convolution layer to the existing architecture before the recurrent…

user1832287
- 329
- 3
- 11
0
votes
1 answer
How can I convert the merge function to be readable on Keras 2.?
I have a program that it has been written for Keras 1.x.x and I am trying to rerun it in Keras 2.x.x. However when it reaches to this point,
from keras.layers import Input, merge
up2 = merge([UpSampling2D(size=(2, 2))(conv5), conv4], mode='concat',…

S.EB
- 1,966
- 4
- 29
- 54
0
votes
1 answer
Mapping NN Output of Keras CNN in Python to interval [0;1]
I attempt to train a CNN to binary classify images of the (maybe uncommon) shape of height=2 and width=1000 pixels. My first approach is a small and simple CNN coded as follows:
def cnn_model_01():
model = Sequential()
# Assembly of layers
…

Inco83
- 65
- 8
0
votes
2 answers
Weights in Convolution Layers in Keras
I want to know if the filters' weights in a, for example, 2D convolution layer in Keras are shared along the spatial dimensions by default. If yes, is there any way to have not shared weights?

Morteza Mashayekhi
- 934
- 11
- 23
0
votes
1 answer
Keras: ValueError: "concat" mode can only merge layers with matching output shapes
I am facing this error in Keras 2. How can I resolve it?
I have imported
from keras.layers import Input, merge
[...]
up1 = merge([UpSampling2D(size=(2, 2))(conv3), conv2], mode='concat', concat_axis=1)
…

S.EB
- 1,966
- 4
- 29
- 54
0
votes
1 answer
In Keras how do I prepare data for input to a sparse categorical cross entropy multiclassification model
So I have a set of Tweets with a few columns such as Date and the Tweet itself and a few more but I want to use 2 columns to build my model(Sentiment & Stock Price) Sentiment analysis is performed on each tweet, and a stock price next to them like…

Definity
- 691
- 2
- 11
- 31
0
votes
1 answer
Tensorflow placeholder in Keras custom objective function
I need to implement a custom objective function for Keras where i need an additional tensorflow placeholder for computation. In tensorflow, i have it as following,
pre_cost1 = tf.multiply((self.input_R - self.Decoder) , self.input_mask_R)
cost1 =…

Awais Jafar
- 1
- 1
0
votes
1 answer
How to get different outputs from the same Keras layer and then combine them?
So basically, I'm creating a CNN with Keras and Tensorflow backend. I'm at the point where I want to insert two layers that have the same input layer and then concatenate them, like so:
model = Sequential()
model.add(Convolution1D(128, (4),…

Filippo Capurso
- 3
- 1
0
votes
1 answer
Getting dimension error while passing the features extracted by CNN to LSTM
I am doing video classification using deep learning in keras. I have extracted the features using VGG16 model whose shape is (7,7,512).I have around 55000 images. I passed this to LSTM layer but getting error of dimensions.
Here is the code,
print…
0
votes
1 answer
keras can not reshape keras tesnor using reshape
I'm trying to reshape tensor using Reshape layer:
from keras.layers.convolutional import Conv2D, MaxPooling2D,AveragePooling2D
from keras import backend as K
from keras.models import Model
from keras.layers import Input
from keras.layers.core…

Adel Saleh
- 13
- 3
0
votes
2 answers
Cannot import keras.initializers
I have imported all necessary modules from keras into jupyter notebook
from keras.preprocessing.text import Tokenizer
from keras.preprocessing.sequence import pad_sequences
from keras.models import Sequential
from keras.layers import Embedding,…

Maciej Osowski
- 115
- 1
- 2
- 7
0
votes
1 answer
Convolution Neural Network input_shape dimension error (KERAS ,PYTHON)
I have a train dataset of the following shape: (300, 5, 720)
[[[ 6. 11. 389. ..., 0. 0. 0.]
[ 2. 0. 0. ..., 62. 0. 0.]
[ 0. 0. 18. ..., 0. 0. 0.]
[ 38. 201. 47. ..., 0. 108. 0.]
[…

ryh12
- 357
- 7
- 18
0
votes
1 answer
Downsampling output tensor before using it as an input to a new layer
I am trying to merge two layers using the functional API. Now my output shape from one layer is not the same as the output shape from the other layer. How may I go about downsampling or compressing the one with the higher image dimension?
eg -…

hello
- 25
- 1
- 4
0
votes
1 answer
Writing your own layer
I am very new to keras.
I'm trying to write (using Functional API) a custom layer in Keras as in Keras.io
class MyLayer(Layer):
def __init__(self, output_dim, **kwargs):
self.output_dim = output_dim
super(MyLayer,…

Samik Banerjee
- 5
- 5
0
votes
1 answer
Difference Between keras.layer.Dense(32) and keras.layer.SimpleRNN(32)?
What is the difference between keras.layer.Dense() and keras.layer.SimpleRNN()? I do understand what is Neural Network and RNN, but with the api the intuition is just not clear.? When I see keras.layer.Dense(32) I understand it as layer with 32…

Nishant Jain
- 197
- 1
- 9