Questions tagged [keras]

Keras is a minimalist, highly modular neural network library providing a high-level API in Python as well as an R interface that allows for rapid prototyping and the use of one of several computational back-ends.

0
votes
0answers
5 views

Error in using K.function together with K.gradients

I'm writing a test model using keras, where in a my_layer I want do some mathematics depends on numerical values of the output of a Lambda layer and its the derivatives. I'm using tensorflow backend....
-1
votes
0answers
4 views

Apply keras embedding lookup weights to LSTM/GRU Layer

I am trying to lookup embedding lookup for given integers using keras embedding lookup. I am able to get embeddings. I want to apply this ebeddings further to LSTM/GRU layer. import numpy as np from ...
0
votes
1answer
11 views

Keras model.predict only returns one figure for binary classification task

I have trained a binary classification task with Keras according to this instruction "https://blog.keras.io/building-powerful-image-classification-models-using-very-little-data.html". However, model....
0
votes
0answers
12 views

How to insert input of different sizes into a convolutional neural network? [duplicate]

I have a list with 5 different sized images that I want to pass to a convolutional neural network, like this : But for having different sizes the network returns me the following error: ValueError: ...
0
votes
0answers
12 views

Cannot train stacked keras models, error: You must feed a value for placeholder tensor 'input_2'

I'm trying to build a model with 2 pretrained models. Here's code for the stacked model: model_only_translation = model_t.get_net_cap_fast_translation(patch_z, patch_height, patch_width, n_ch, ...
0
votes
0answers
14 views

problem with converting model used ResNet50 from h5 to pb in keras

I'm new to Neural Networks, and I'm familiar with keras only. I'm trying to create a model that works on Android. I have created a model that is .h5, so i need to convert it to .pb in order to run it ...
0
votes
0answers
16 views

AutoEncoders not showing the expected output in keras

I'm experimenting with AutoEncoders in Keras . where I have a data set (network intrusion NLS-DATASET) that I want my auto encoder to learn its identity and be able to reconstruct the input. but it ...
0
votes
0answers
13 views

Is there a way to combine Conv2D layers with LSTM?

I'm setting up a keras model with Conv2D and LSTM layers and i try the following code .. i am trying not to reshape the LSTM layer but it also gives me an error that the index is out of range. I have ...
0
votes
0answers
17 views

why this error happen when I want to produce a tensor using repeat?

I have an input layer wtm=Input(4,4,1) in Keras and I want to produce new tensors with shape (None,28,28,1) from each value in wtm for this I use this code but it produces the following error and I do ...
0
votes
0answers
17 views

extracting image feature vectors in convolution neural network

i have an image dataset that consists of 376 classes . each class consists of 15 images for a specific person .class names (which are the labels) are strings from 000-377 . i want to get the feature ...
0
votes
0answers
13 views

keras.module.load_model raise TypeError('Keyword argument not understood:', kwarg)

I'm trying to perform transfer learning on a mobilenet using Keras and the Flower DB provided for example in tf. The training works well and I perform predictions but I'm not able to save the model to ...
0
votes
0answers
15 views

Can tensorflowjs_converter work with Keras models made with functional API?

I'm trying to convert models made with tf.keras in Python to tensorflow.js format for use in Node.js. Here are my package versions: tensorflowjs: 1.0.1 Keras: 2.2.4 tf-nightly-2.0-preview: 2.0.0....
0
votes
1answer
21 views

Keras h5 to Tensorflow serving in 2019?

i tried to follow this tutorial on how to convert a Keras H5 Model zu ProtoBuff and serving it using Tensorflow Serve: https://towardsdatascience.com/deploying-keras-models-using-tensorflow-serving-...
0
votes
0answers
12 views

Create adversarial examples in custom keras loss function

I'm currently trying to create a custom loss function for a Keras model. I want the loss function to create an adversarial example INSIDE of it, given the current image that is being proccessed while ...
0
votes
0answers
20 views

ValueError: Error when checking target: expected conv2d_24 to have shape (256, 256, 1) but got array with shape (256, 256, 3)

I'm applying UNET biomedical segmentation network on colored image data and Ground truth of 50 images (converted into NPY file of size 50,256,256,3 each), but getting above error and network is unable ...
0
votes
1answer
13 views

tensorflow:Write failed because file could not be opened

when i train my network,the first 100 epoch work well,but some thing wrong show:Write failed because file could not be opened,but it is still training,does it matter? Epoch 243/243 162/162 [==========...
0
votes
0answers
5 views

Keras discriminative labeling in Loss function

I have the following problem of implementing a costume loss function for an autoencoder in Keras which calculates: X = (y_true - y_pred) The Otsu Threshold of X Creates a subset of X according to ...
0
votes
0answers
10 views

How to ensure the integrity of validation data in time series problem and set up a baseline properly

I am working on a time series problem where i have multiple possibly correlated datasets where my samples are timestamped and have a certain amount of lookback. My ultimate goal is to essentially ...
0
votes
2answers
27 views

CNN training multi label classification---not working

Try to predict texture images' labels, an image can contain two labels like['banded', 'striped'], though most of them only have one label. The output accuracy is extremely high....the first epoch can ...
0
votes
0answers
9 views

Knowing when to stop training GAN/ when it's overfitting (sequence classification study)

I have sequences of long, sparse 1_D vectors (10000 digits, made of of 0s and 1s) that I am trying to classify. I have previously implemented a simple CNN to classify them with relative success (with ...
0
votes
2answers
22 views

CPU usage and time until training starts increasing on each model.fit() in Keras

I created an LSTM with Keras API. Now I am facing an issue while I try to test different values in it (for learning rate f.e.). Each time I change my values and define the model new somehow the model ...
0
votes
0answers
12 views

Using Tensorboard to get live keras model stats while training

I how does one get some type of live progress feed in tensorboard will while a keras model is training. Like a progress bar stating how far the process is, the graphs showing acc, val_acc, loss and ...
0
votes
1answer
13 views

How to model an event and time series generation with unequal length

I have a dataset containing multiple time series with two features a time and a corresponding event. The time series are of unequal length. Im filling the shorter ones with values that indicate the ...
0
votes
1answer
18 views

The name “Generator” is used 2 times in the model. All layer names should be unique

I am trying to make a cycle-GAN for an unpaired image to image translation as per this reference. when trying to compile the combined model, following error encounters. I don't know why is it so as I ...
0
votes
0answers
11 views

Initialize variables with keras

I am training a model with tensorflow.keras model.fit function. Do I need to initialize variables before training? If I call with tf.Session() as sess: init=tf.global_variables_initializer() ...
0
votes
0answers
5 views

Orthogonal Regularisation on layer activation

I want to add orthogonal regularisation on output activation (Y) of a dense layer. i.e., min ||Y'Y - I||_F def regOrth(Y): m = K.batch_dot(K.transpose(Y), Y) - K.eye(Y.shape[2]) return K.sqrt(K....
0
votes
3answers
28 views

why set return_sequences=True and stateful=True for tf.keras.layers.LSTM?

I am learning tensorflow2.0 and follow the tutorial. In the rnn example, I found the code: def build_model(vocab_size, embedding_dim, rnn_units, batch_size): model = tf.keras.Sequential([ tf....
0
votes
0answers
25 views

How can I use different length of input and output data in MLP using Keras or Tensorflow?

I wonder how can I input different length of data to multilayer perceptron and get different length of output data. Let's assume that I want to fit data separately (not in batches) in the way shown ...
1
vote
1answer
18 views

Uncaught (in promise) Error: Provided weight data has no target variable: block1_conv1_2/kernel

I am new to machine learning and I was following this blog on how to write a model with mobilenet. I managed to convert the .h5 file model and tried to implement it on my web app. Unfortunately, ...
0
votes
1answer
30 views

Simple autoencoder is not converging after many epochs

I am developing an autoencoder for CIFA10 dataset, without adding noise at the input (which is 2nd goal). The Convnet based autoencoder is not converging: Any suggestions input_img=Input(shape=(32,...
0
votes
1answer
19 views

How to know labels of generated images in WGAN using keras

I am working on medical image classification problem, and suffering from low data set problem. So want to generate images using WGAN. In given code WGAN code example is taken of MNIST data set. after ...
0
votes
0answers
32 views

ValueError: Error when checking input: expected lstm_1_input to have 3 dimensions, but got array with shape (6782, 36)

I tried to do human pose action recognition model, I referred this model I like to use LSTM for this model. So I have made some changes in train.py My train.py code: import pandas as pd from ...
0
votes
1answer
27 views

How to import numerical values as weight into the Keras/Tensorflow layers?

I used a simple regression problem as below to illustrate my question. I have a model with various layers. For two specific layers, conv1 and dense2, they have parameters in size of "2x2 = 4" and "...
0
votes
1answer
34 views

Why does my Keras training not resume properly?

I am trying to ensure my training is resumed properly. Training uses Adam optimizer from tf.keras.optimizers. I do set both TF and NumPy seeds. model.compile(optimizer: new Adam(), loss: ...
0
votes
0answers
15 views

any solution to fix embedding look-up error for keras model?

I am working with character level cnn model for sentence classification, and I used keras framework to build my model. However, model compilation was good, but when I tried to fit my model I faced ...
0
votes
1answer
11 views

Memory error in multi-inputs model when using Keras ImageDataGenerator

It's not working when using Keras ImageDataGenerator. Anyone could tell me the problem of these codes, thx. Keras: 2.1.5 TFgpu: 1.4.0 OS: Win 10 And the Error as follows: Epoch 1/50 98/27100 ...
0
votes
1answer
20 views

Keras functional API multiple input LSTM

I am trying to build two inputs LSTM model using Keras functional API. Here is the code I used: inp_1 = 100 inp_2 = 100 out_1 = 10 N_FEATURES = 1 Input_1 = Input(shape=(inp_1, N_FEATURES), name='...
0
votes
1answer
20 views

How to expand dims of my Keras layer and avoid using Lambda layer

I' m using tensorflow.js and try to convert my keras model to tf.js model. However, it doesn't support Lambda layer which I try to use to convert tensorto layer(I use expand_dims) in my model(If not ...
0
votes
0answers
8 views

How to get non-binary output from keras/.tfite model?

I have a Keras model, which I then converted into a .tflite model. The model is a binary classifier using binary_crossentropy. With keras I can call model.predict() to get a decimal prediction eg ...
1
vote
0answers
28 views

Convert a saved .h5 file to a JSON file

I used a pre-made model with Keras for training a data-set about URLs. results are saved in a .h5 format and I am wondering if I could convert that saved .h5 file to JSON so that I could see the ...
-1
votes
0answers
6 views

How to use NVLink with Keras?

Via Keras multi_gpu_model it's simple to create a model in Keras which will use multiple GPUs. However, if I have several Nvidia graphics cards connected via NVLink, will a Keras multi_gpu_model ...
0
votes
0answers
21 views

How to feed input to hidden layers in Keras?

I'm running a multi-staged training in Keras, where I first train a model that is structured like so: inpu=Input(shape=(600,)) additive_layer=Dense(1,use_bias=False,activation="linear")(inpu) ...
1
vote
0answers
16 views

Tensorflow Estimator + Dataset API w/ Placeholders + Keras Model

I have built a custom keras model (create_model). The model is then used to build an estimator. With the estimator, I wish to train my model with input_fn argument = train_input_fn. I have built this ...
0
votes
0answers
15 views

Keras dynamically adjust dropout probability

I'd like to dynamically adjust the value of the dropout based on my iteration during training. Most of the examples currently use a fixed value for dropout. model.add(Dropout(0.4)) I'd like my ...
0
votes
0answers
13 views

Understanding metrics computation in Keras

I have tried to implement a true positive metric in Keras : def TP(y_true, y_pred): estimated = K.argmax(y_pred, axis=1) truth = K.argmax(y_true, axis=1) TP = K.sum(truth * estimated) ...
-1
votes
0answers
23 views

How to feed spatio-temporal data files to Neural Networks? [on hold]

I am trying to use Recurrent Neural Networks to predict temporal results. However, my training data contains location statistics as well, each time-step has one csv file, each file has location, ...
0
votes
1answer
21 views

Tensorflow Keras: Can `Conv2d` layers now accept multispectral images meaning bands greater than 3

I have some 8-band satellite images and wanted to do some image segmentation with Tensorflow and Keras. I tried to do this a couple of years ago, but saw that TF and Keras could not handle images with ...
0
votes
0answers
33 views

how do I access a specific value in a tensor?

I have an input layer wtm=Input(4,4,1) and I want to access each value of this layer during learning. for accessing to wtm[1,1]( the value in row=1 and column=1) I use this code a=Kr.layers.Lambda(...
0
votes
0answers
8 views

Tensorflow decode_image returns <unknown> shape

I follow this tensorflow guide. The following code on their side returns (212, 320, 3), while on my side it returns <unknown> (I do not use the same image they test with, I have my own jpg image,...
-2
votes
0answers
12 views

Creating an encoder-decoder with LSTM and bag of words

I am wondering how to create a specific type of encoder-decoder. I would like to know the best approach and also see a snippet of code. I want to create embeddings for diagnosis code. Each row of my ...

http://mssss.yulina-kosm.ru