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.

1
vote
0answers
8 views

Keras layer with int inputs cannot be built

I have a complex keras model in which one of the layers is a custom pretrained layer which expects "int32" as inputs. This model is implemented as a class that inherits from Model and it is ...
1
vote
0answers
7 views

Implementing dynamic_bidirectional_rnn to tf.layer.Bidirectional

I have used BasicLSTM, MulttiRNNCell, bidirectional_dynamic_rnn in a code for testing the code for proof of concept, which was a success but now for publishing code for the production level I need to ...
2
votes
1answer
10 views

Keras 2d prediction of scattered

Keras prediction returns the same value everywhere. I have some xyz data that I want to predict in a regular grid, using keras ML. I am using something wrong and can't figure it out. import numpy ...
1
vote
2answers
18 views

what is the corresponding function of K.gradients for tensorflow 2.0?

I want to visualize the classification result with tensorflow2.0. For keras, it need the following code for cam: import tensorflow as tf import keras.backend as K from tensorflow.keras.applications....
1
vote
1answer
9 views

KERAS-Instructions for updating: Colocations handled automatically by placer

I am Using Keras Library For my Neural Network error. While using Dropout I got the 3 following warning WARNING:tensorflow: colocate_with (from tensorflow.python.framework.ops) is deprecated and ...
0
votes
0answers
14 views

Keras CNN Will Train Most Epochs Then Fail - Incompatible Shapes

I am attempting to train a CNN on the malaria cell images data set found here: https://www.kaggle.com/iarunava/cell-images-for-detecting-malaria I have specified the computational graph, and the ...
0
votes
1answer
18 views

Keras using tensorflow backend with Flask graph error

I am deploying a Keras InceptionV3 model using Tensorflow back-end using Flask-Python. It is trained on Places2-Challange dataset by MIT. Code works fine on Google Colab but now I am getting this ...
0
votes
0answers
13 views

How to implement a L2 pooling layer in Keras?

I am trying to find out if there are any ways to implement an L2 Pooling Layer in Keras. Does anyone have any idea of how to deal with it?
0
votes
0answers
13 views

Can someone explain how to use a CMC in keras?

I have been trying to figure out how to do rank 1-10 in keras using CMC (cumulative match characteristic) and I found some code in both pythroch and keras. But I cannot figure out how it works. The ...
1
vote
3answers
22 views

number of epochs to be used in a keras sequential model

i'm building a keras sequential model to do a binary image classification. now when I use like 70 to 80 epochs I start getting good validation accuracies (81%). but I was told that this is a very big ...
-1
votes
0answers
17 views

How should I improve the accuracy of my model

I generate an np array of image data which I then use to train my model however the accuracy of my model is below 10% implying that my model is not learning. I was just wondering if someone could look ...
-1
votes
0answers
12 views

LSTM Predicted Values Seem to be Following my Actual Values

Creating my first LSTM to predict the number of times a sensor in the room is activated. I'm following this guide: https://machinelearningmastery.com/multivariate-time-series-forecasting-lstms-keras/ ...
1
vote
1answer
21 views

How to connect two LSTM models in Keras

I want to create a model with two LSTM layers with Keras. The following code however, generates an error: from keras.models import Sequential from keras.layers import LSTM, Dropout, Activation from ...
0
votes
0answers
15 views

Unable to go from tf.keras model -> quantized frozen graph -> .tflite with TOCO

I am new to all of these tools. I'm trying to get started with using Tensorflow Lite to ultimately run my own deep learning models on the Coral Edge TPU. I have built a toy XOR network with the ...
0
votes
0answers
17 views

Keras: model.fit_generator works well then breaks down

opt/conda/lib/python3.6/site-packages/keras/callbacks.py in on_batch_end(self, batch, logs) 234 else: 235 if k in self.totals: --> 236 self....
0
votes
1answer
16 views

Keras Not so Dense Layer

Previous layer is embedding size (V clasess,K -outputdim) - I want to introduce a weights matrix size K x T. The weights will be trainable (as will the embeddings).They generate a VxT matrix will be ...
0
votes
1answer
15 views

ValueError: `sequences` must be iterable in Keras

I am trying to build a sentiment analysis model but when i start training,i am getting error as ValueError: sequences must be iterable. pad_sequences is what gives error. code till the function ...
0
votes
0answers
9 views

How to evaluate data using a trained tensorflow NN on separate threads

I've been trying to make a NN that will evaluate 2-second chunks of data coming from a stream on a raspberry pi. The NN is trained and the stream is under control, but to reduce latency, we wanted to ...
0
votes
0answers
16 views

Using keras or tensorflow to train cnn with one output, with two separate datasets each corresponding loss function

I'm trying to train a cnn with one output with two datasets. I want to be able to in each batch to feed some data from the first dataset and some data from the second dataset and each dataset has a ...
0
votes
0answers
21 views

Tensorflow Lite model inference has very low accuracy

I want to create a model that predicts the age and the gender and to integrate it in an android app. I am on Ubuntu 16 and use Python 3.6, Tensorflow 1.13.1 and Keras 2.2.4. First I train different ...
0
votes
0answers
15 views

Error when running more than one console in spyder with anaconda tensorflow GPU enviroment, while running tf.keras

Whenever I tried running code using tf.keras in more than one console, I got an error: Traceback (most recent call last): File "", line 31, in model.fit(X_train, Y_train, ...
0
votes
1answer
18 views

Approximation of funtion with multi-dimensional output using a keras neural network

As part of a project for my studies I want to try and approximate a function f:R^m -> R^n using a Keras neural network (to which I am completely new). The network seems to be learning to some (...
0
votes
0answers
7 views

How to set up a grid search for a GRU model?

'''Hi! I have never did a grid search for NN models yet, and it appeared to be not so straight forward task like for linear regression. I am totally confused. Could please tell me what do I do wrong, ...
0
votes
0answers
7 views

Implementing CTC without textImagegenerator in keras

In keras/examples/image_ocr ctc loss was calculated using with TextImageGenrator which require monogram file and bigram file. Can it be possible to feed only image and there ground truth values to ...
0
votes
0answers
13 views

Tensorflow generate TFRecord

Im following this tutorial to train a object detection neural network. I'm trying to create a TFRecord, like this: !python ~/models/research/object_detection/dataset_tools/create_pet_tf_record.py --...
0
votes
1answer
17 views

How to fix ''NoneType' object has no attribute '_inbound_nodes'' ' when working wih Keras layer Lambda

I'm trying to use a Lambda layer to wrap a function ('get_reconstruction_loss') that combines two layers in a way so that it calculates the MSE of the results of both. Unfortunately, I can't ...
0
votes
1answer
23 views

Why is the Average Precision of my TensorFlow model -1.000?

I've been training an object_detection TensorFlow model for a while now, but I've noticed that the evaluation table always shows a value of -1.000, whereas I've seen other peoples' outputs display ...
-1
votes
0answers
24 views

Fix Google Collaboratory GPU performance?

I was wondering if anyone could help me out with an issue I am having with Google collaboratory? I am trying to make sure that the program that I am working on actually runs on the GPU since I have ...
0
votes
0answers
8 views

different results when run the same code ,the same data using in keras when run dssm model [on hold]

Now i run dssm model using keras.And it occured weired issues,the result will be so different when run the same code,the same data .What possible issue it will happen
-3
votes
0answers
22 views

What will be structure of train_data for triplet loss while training a model for problem like street2shop?

I want to train model for street2shop or any problem that uses triplet loss. So for training i have list of triplets each triplets contains set of 3 arrays(numpy array of images) but when I pass fit ...
0
votes
0answers
5 views

How to extract keyword semantically from a research papers using pre-trained word embedding GLOVE

I have the features title and abstract.i wanted to extract key-words semantic using pre-trained word-embedding GLOVE using keras. Could you please guide me about my project or any recommended ...
0
votes
0answers
12 views

tf.assign doesn't update tf.Variable value in custom callback init constructor using model._function_kwargs

I need to create a custom callback to get the target values i.e, y_true and y_pred (predicted values). So, I read the post :Create keras callback to save model predictions and targets for each batch ...
1
vote
1answer
27 views

Keras submodel needs to be built

I am creating a python class that inherits from a keras model. class MyModel(tf.keras.models.Model): def __init__(self, size, input_shape): super(MyModel, self).__init__() self....
1
vote
1answer
33 views

Why is my custom loss function not accepting converted numpy arrays?

I am trying to write a custom loss function that will operate on the NN output after forward pass but before back prop by calling an external function (not written with the keras/tensorflow backend ...
-1
votes
0answers
31 views

Why do U-net trains successfuly and Fast-SCNN not training at all on same data?

I'm new to neural networks and I'm working on image segmentation problem (both single and multiclass) and have good results with classic U-net model and modified with bottleneck blocks from ...
0
votes
0answers
19 views

The return value of model.evaluate_generator

I don't understand: since that the model is evaluated on a group of images, not a single image, so I think the score should return the average value of loss or metrics over the group of images. score =...
2
votes
1answer
28 views

What is the purpose of Keras custom objects when creating custom layers?

Looking at layers implementations of third parties, like tensorflow_addons, I see that each layer is being registered as a custom object. For example, you can see the use of the wrapper ...
1
vote
1answer
27 views

Why the output of hidden deep layers have zero variance for some dimensions?

I have designed a simple ConvNet with keras which will process some images into two classes. The images are not real-world photos but they are signals converted to images. The model is trained well ...
2
votes
1answer
34 views

How to wrap tf.cond function with keras.layers.Lambda?

I'm trying to define a custom layer in keras,but I can't find a way to warp tf.cond with layers.Lambda function matches = tf.cond( tf.greater(N, 0), lambda: ...
0
votes
1answer
23 views

Sliding window approach for DNN

I'm trying to implement the sliding windows approach and use DNN for the forecasting part. The window length = 24 What I did: I have x (input) and y (output) in the data set. I kept the "y" value as ...
3
votes
1answer
21 views

Difference between DepthwiseConv2D and SeparableConv2D

From the document, I know SeparableConv2D is a combination of depthwise and pointwise operation. However, when I call SeparableConv2D(100, 5, input_shape=(416,416,10) # total parameters is 1350 ...
0
votes
0answers
24 views

Handle categorical features with many uniques Tensorflow Neural Network

I am trying to predict which hotel a given user will book. I have 12 input columns, which are all categorical and are in INT format. I am trying to train a Neural Network using Tensorflow and Keras to ...
1
vote
0answers
19 views

Model.trainable = False vs. Model.compile()

Are these claims correct? Model.trainable = False by itself has absolutely no effect (to anything compiled) unless compilation happens. If I take two layers in ModelA which has been compiled (ModelA....
-5
votes
0answers
16 views

What is the best way to detect street names in images ? I have about 1.5 Million images and need to pull out images with street signs in them [on hold]

I have tried it through CNN using Tensorflow and Keras but it is not recognizing the street names.I am thinking of going into OCR to recognize text detection and localization in the images.
1
vote
1answer
18 views

Mismatch in expected Keras shapes after pooling

I'm building a few simple models in Keras to improve my knowledge of deep learning, and encountering some issues I don't quite understand how to debug. I want to use a 1D CNN to perform regression on ...
0
votes
0answers
18 views

AttributeError: NoneType' object has no attribute '_inbound_nodes'

I am trying to build a DeClarE model (https://www.aclweb.org/anthology/D18-1003) based on code given at https://github.com/connectsoumya/declare/blob/master/data_preprocessing.py in google colab but ...
0
votes
0answers
21 views

.tflite model (converted from keras .h5 model) always predicts the same class with same probability

I've trained a model (using keras) to count number of fingers held up. The model works really well (~99% accuracy on test images). Now, I'm trying to deploy this model on the edge by converting the ...
0
votes
0answers
13 views

Is there any way to use Keras like Theano in terms of inputs layer

My question is about input layer difference between Keras and Lasagne Libraries. I've a time series dataset with length of 100.000 timesteps. I split the dataset as 500 timesteps for each samples. So ...
0
votes
0answers
16 views

ValueError: No gradients provided for any variable in Keras

I am seeing errors of the following: ValueError: No gradients provided for any variable: ["", "", "", "", "", ""]. I have composed a customized loss function (kl_loss): def tensor_pValue(pnls,pnl)...
3
votes
2answers
41 views

Keras: Share a layer of weights across Training Examples (Not between layers)

The problem is the following. I have a categorical prediction task of vocabulary size 25K. On one of them (input vocab 10K, output dim i.e. embedding 50), I want to introduce a trainable weight matrix ...