Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [keras]

Keras is a minimalist, highly modular neural network library written in Python.

0
votes
1answer
15 views

Training multiple keras models and combining outputs to determine losses

I'm trying to predict the future states of a 1D travelling wave (square, triangle and sawtooth) using a deep learning setup in Keras. The waves are discretised in a 1024 data points. As this gives a ...
0
votes
0answers
4 views

Keras model structure to get single float result

I need to solve regression problem from 200 float values in range [-1.0 to 1.0] to one float value in the same range. 0.1 and 0.01 here is totally different results. Now I'm trying this model: ...
0
votes
1answer
17 views

LSTM : Bad Data or Low preparation

I have three features {feature1, feature2, feature3} the middle have negative sign for some values and i am trying to predict the middle one using LSTM with window size of 10 but i get very high RMS ...
0
votes
0answers
8 views

access numpy functions from keras backend

I need to compute inverse of covariance matrix of two arrays in loss function in keras. But as there is no inverse function in keras backend, I want to use numpy's inverse function. How can we access ...
0
votes
1answer
12 views

LSTM : multi-step multidimensional multivariate multi-site timeseries forecasting

I'm working on a project in which i'm trying to do a pollution forecasting. I googled around and found that LSTM is a good candidate for this task, however, I'm still struggling at how to adapt it to ...
0
votes
1answer
12 views

Feature Scaling and normalization in cross-validation set

I have a question that normally, when we are making a training set and a final test set, we would compute the mean and standard deviation for preprocessing using the training data and use it to ...
0
votes
0answers
3 views

Switching from framewise to CTC sequence prediction mid-training?

I have written a toy model using LSTM layers to learn phone*ic transcription of German sentences based on the kielread EMU corpus. The data is annotated ‘framewise’ ...
0
votes
0answers
6 views

Why does my custom categorical cross-entropy explode with Keras while not with TensorFlow?

I'm trying to train various Keras models on Pascal VOC 2012 dataset. The particularity of this dataset is that there is a particular class used to label "ambiguous" regions. These pixels are meant to ...
1
vote
1answer
33 views

custom loss in keras, problem with batch size

I am trying to create a custom loss function,custom_loss(y_true, y_pred). I understand that y_pred is calculated by my model but ...
1
vote
1answer
34 views

How to optimally train deep learning model using output as new input

I'm trying to train a network to predict the future. My current setup uses 5 time steps as inputs from the past, each consisting of 10 features, resulting in a [5, 10] input matrix (initially ...
0
votes
1answer
21 views

Input and output Dimension of LSTM RNN

I am fairly new to RNNs and Im having trouble setting up the desired output from RNN using Keras library. Each datapoint in my dataset consist of a pattern of labels and timestamp of occurrence of ...
0
votes
1answer
24 views

Using categorial_crossentropy to train a model in keras

I'm a novice in machine learning. I was following this Keras blog to train image classifier using Keras. Though this blog only demonstrates how to train only two classes using binary_crossentropy, I ...
1
vote
0answers
11 views

How do I implement an attention mechanism for convolutional neural network in Keras?

I have a convolutional neural network in Keras on which I'd like to add an attention mechanism? Has anyone done this? It seems Keras doesn't have an in-built attention mechanism and the ones I've ...
1
vote
0answers
14 views

Import the same interval of previous week into the deep model

In a dataset, the data are the average of vehicles speed in the points (cells) of a map. I am trying to build a prediction model. While the inputs are the average of vehicles speed of all points in ...
0
votes
2answers
14 views

Keras y-labels range between 0 and 1 instead of binary?

I have X values and corresponding y-labels, until now I used to round my labels <0.5 to 0 and >0.5 to 1. Is it possible to use values between 0 and 1 for "y train"? Using Keras and Tensorflow. ...
2
votes
1answer
34 views

Keras - How to classify 1D time series

Say I have a training dataset composed by 128 1-Dimensional time series in form of numpy arrays. They all correspond to a certain action that I label action_1 and ...
0
votes
2answers
38 views

How to find out bad images?

I have a task to find out bad visuals from given video. Let's define bad images in the video as per the human brain -: ...
0
votes
0answers
7 views

Convert generator to DirectoryIterator in Keras

I created a multi input deep learning model, and a lot of functions I could not use it because the testgenerator (in the code) is a generator not a DirectoryIterator. ...
1
vote
0answers
10 views

Transformer architecture not working on toy problem

My transformer is not working on a toy problem. Toy problem Input : Sequence of random integer, one-hot-encoded. Example : ...
0
votes
1answer
27 views

How to handle noisy data?

I have X values such as [0.2, 0.1, 0.3, 0.5, 20, -0.2, -0.1, -0.6, -0.8, -30] Now I know that if the abs value is below a certain threshold, let's say 2, the y-...
1
vote
0answers
10 views

Any consideration for image classification when one class has generally one particular color

I am trying to predict rooftop orientations among: horizontal, vertical, flat, unknown. The particularity of horizontal and vertical rooftops, is that it's color generally is reddish, the reason of ...
1
vote
1answer
43 views

How to make my Neural Netwok run on GPU instead of CPU

I have installed Anaconda3 and have installed latest versions of Keras and Tensorflow. Running this command : ...
1
vote
1answer
24 views

Sparse_categorical_crossentropy vs categorical_crossentropy (keras, accuracy)

Which is better for accuracy or are they the same? Of course, if you use categorical_crossentropy you use one hot encoding, and if you use sparse_categorical_crossentropy you encode as normal integers....
0
votes
1answer
19 views

Predicting on real test set gives only very high probability for 1 for a very unbalanced data

Excuse me for this brief description of the problem, as I'm very bound on time, I'll try to sum up as much as I can. I have a multivariate time-series, that I trained using an RNN, there are periods ...
1
vote
1answer
35 views

How to apply class weight to a multi-output model?

I have a model with 2 categorical outputs. The first output layer can predict 2 classes: [0, 1] and the second output layer can predict 3 classes: [0, 1, 2]. How can I apply different class weight ...
1
vote
0answers
51 views

Training multi-label classifier with unbalanced samples in Keras

I'm trying to train a keras model that takes in samples, let's say $x_i$ for sample $i$, and predicts multiple independent labels, $\hat{y}_{ij}$, such that $\hat{y}_{ij} = 1$ if the model predicts ...
1
vote
1answer
21 views

Training images with multiple channels

So I have a set of images with 16 layers each. Is there a good reason to split the channels in a format like example : [images_length,16,image_width , image_height] instead of creating something ...
0
votes
1answer
23 views

Extracting embeddings of Categorical Variables

I am trying to build a regression model, for which I have a nominal variable with very high cardinality. I am trying to get the categorical embedding of the column. Input: ...
0
votes
0answers
8 views

Prevent predict_generator from shuffling data in deep learning

I created a cnn model, and I want to check the performance of the model by using predict_generator. I am using the following code which compares the images' labels ...
0
votes
1answer
21 views

Using classification of previous sample in neural networks

I am trying to classify the state of a machine using different features coming from a set of sensors. I am treating the problem like a time series, so I windowed the stream of the sensors each X ...
0
votes
0answers
15 views

Input shape for simpler time series in LSTM+CNN

Following is code from https://machinelearningmastery.com/how-to-develop-rnn-models-for-human-activity-recognition-time-series-classification/ which uses LSTM and CNN with TimeDistributed for human ...
0
votes
0answers
11 views

Keras: pass output of LSTM to different layers

I have an LSTM layer in Keras. I want to pass its output with return_sequences=True to another LSTM layer and with return_sequences=False to a Dense layer. How can this be done. In order to pass it to ...
0
votes
0answers
22 views

How to let predict_generator make ordered prediction when using functional API model in deep learning?

I am designing a deep learning model to classify images and I am using the following code to check the predication performance. It compares the images' labels with the predicted classes and then ...
2
votes
1answer
47 views

Visualizing word embeddings

I am working on a text-classification problem, and trying to understand how to work with the tensorboard projector for an embeddings layer in Keras. Borrowing an example from the Deep Learning with R ...
1
vote
0answers
33 views

Custom Loss Function on a Keras Neural Network

I'm training a Neural Network on Keras to predict class as a triplet of the form S,P,T, where S, ...
1
vote
1answer
21 views

How to save prediction values for the whole data in Keras

I am using pre-trained VGG16 model to classify images located in the folder. Currently, I am able to classify only one single image. How can I modify the code to classify all the images in the ...
2
votes
0answers
24 views

Mixing Textual Data and Numerical Data (Neural Network)

I have 2 "nature" of data (more actually if I count images data) : Textual (that I treat with special tokenization and a TfIdfVectorizer) ~ 5000 features Non textual (like length of sentences, # of ...
3
votes
1answer
41 views

Probability Calibration : role of hidden layer in Neural Network

I try a simple Neural Network (Logistic Regression) to play with Keras. In input I have 5,000 features (output of a simple tf-idf vectorizer) and in the output layer I just use a random uniform ...
1
vote
1answer
27 views

Which regularization in convolution layers (conv2D) [closed]

I am using Keras for a project. I would like to know if it makes any sense to add any kind of regularization components such as kernel, bias or activity regularization in convolutional layers i.e <...
0
votes
0answers
9 views

Poor performance of Collaborative Filtering using Matrix Factorization

I am trying to train a collaborative filtering model using embeddings (or matrix factorization) as described here on the movielens dataset. Here is the Keras implementation: ...
0
votes
0answers
11 views

Training The Generator using pre-trained Discriminator

I have a trained discriminator that can discriminate between real and fake images with 97% accuracy. Now I want to train a generator which forces to regenerate the real images as fake images. Lets say ...
1
vote
0answers
43 views

Using a custom R generator function with fit_generator (Keras, R)

I'd like to train a convolutional network to solve a multi-class, multi-label problem on image data. Due to the nature of the data, and for reasons I'll spare you, it would be best if I could use a ...
2
votes
0answers
33 views

Load keras model in Java

What are requirements to load trained model by Keras in Java? I checked that DeepLearning4J supports Keras models, network architecture and weights can be easily loaded. The only cons is probably that ...
0
votes
0answers
22 views

What does it mean when a model trained in Keras has zero loss for much of each epoch?

I'm attempting to train a model in Keras and I've noticed a pattern that seems to be occurring. Namely, for much of each Epoch, the loss is identically zero. For example, in a model I'm currently ...
0
votes
1answer
14 views

Can RNN learn for each `t` in time from a whole new dataset (many entries)

Basically, my data set is not as simple multi-variate time-serie as it's often (to some extent) the case. For each month, I have N entries (not less than 3000). Can RNN of any variant (Please bear my ...
0
votes
2answers
37 views

How to learn from time series with multiple values for each time points

A multivariate time-serie has more than one time-dependent variable and it is my case. Still for each time I have not one entrie of dependent variables but many entries, like: ...
1
vote
1answer
80 views

Why isn't my model learning?

...
0
votes
0answers
5 views

Cannot read .7z file in Google Colab [migrated]

I am using Google Colab to create a deep learning model, and I face an issue when I run this code at the first time. !p7zip -d filename.7z I get the following ...
3
votes
2answers
73 views

How to use a NN architecture that is too big for GPU?

Initially posted in Stack Overflow. I would like to implement a model which is actually 2 neural networks stacked together. However the size of these 2 architecture is too big to fit in GPU at the ...
1
vote
0answers
3 views

I have to find homography transform parameters which are 8 in number with the help on CNN [closed]

I have to find homography transform parameters which are 8 in number..I m using a pretrained residual network. The problem I am facing is I am not able to use model.fit() as it takes argument such as ...