Questions tagged [keras]

Keras is a popular, open-source deep learning API for Python built on top of TensorFlow and is useful for fast implementation. Topics include efficient low-level tensor operations, computation of arbitrary gradients, scalable computations, export of graphs, etc.

988 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
14
votes
0answers
2k views

Understanding Timestamps and Batchsize of Keras LSTM considering Hiddenstates and TBPTT

What I'm trying to do What I am trying to do is predicting the next data-point $x_t$ for each point in the timeseries $[x_0, x_1, x_2,...,x_T]$ in the context of a date-stream in real-time, in theory ...
7
votes
2answers
173 views

How to implement hierarchical labeling classification?

I am currently working on the task of eCommerce product name classification, so I have categories and subcategories in product data. I noticed that using subcategories as labels delivers worse results ...
6
votes
1answer
5k views

Keras - Implementation of custom loss function with multiple outputs

I am trying to replicate (a way smaller version) of the AlphaGo Zero system. However, in the network model, I am having a problem. The loss function I am supposed to implement is the following: $$l = ...
6
votes
0answers
2k views

Why is my Keras model not learning image segmentation?

Edit: as is turns out, not even the model's initial creator could successfully fine-tune it. This is most likely a problem of implementation, or possibly related to the non-intuitive way in which the ...
5
votes
0answers
2k views

Tensorflow v1 Dataset API AttributeError with ndim

I'd like to make pipeline for optimizing Gpu and Cpu. Dataset It's about 10000 datapoint and 4 description variables for the regression problem. ...
5
votes
0answers
62 views

Training value neural network AlphaGo style

I have been trying to replicate the results obtained by AlphaGo following their supervise learning protocol. The papers specify that they use a network that has two heads: a value head that predicts ...
5
votes
1answer
2k views

Loss function for optimising precision & recall / sensitivity & specificity?

I've been using precision and recall as my metrics, as per keras-team/keras/pull/9393/files Sensitivity & specificity is what I want to optimise for. Every epoch I output it: ...
4
votes
0answers
140 views

1D CNN Variational Autoencoder Conv1D Size

I am trying to create a 1D variational autoencoder to take in a 931x1 vector as input, but I have been having trouble with two things: Getting the output size of 931, since maxpooling and upsampling ...
4
votes
1answer
775 views

Is it wrong to use Glorot Initialization with ReLu Activation?

I'm reading that keras' default initialization is glorot_uniform. However, all of the tutorials I see are using relu ...
4
votes
0answers
656 views

Tensorflow, Optimizer.apply_gradient: 'NoneType' object has no attribute 'merge_call'

My program gives the following error message: ...
4
votes
1answer
62 views

Training Machine Learning Model - Neural Network - Islands Problem

I was working on the following leetcode problem: Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting ...
4
votes
1answer
2k views

Autoencoders for the compression of time series

I am trying to use autoencoder (simple, convolutional, LSTM) to compress time series. Here are the models I tried. Simple autoencoder: ...
4
votes
1answer
639 views

How to use PCA in CNN for image recognition using Keras?

I created a CNN model for image classification and I want to use Principal Component Analysis (PCA) but when I run pca.fit() code, the code still running for hours ...
4
votes
0answers
225 views

Optimal implementation of vanilla DQN loss in Keras

I've implemented vanilla DQN for continuous/non-images (no CNN) states in keras. But, I'm not sure if my implementation of the loss computation is optimal. For reminder the loss is defined as : $loss=...
4
votes
2answers
4k views

Saving and loading keras.callbacks.History object with np.save and np.load

I have been saving my training history in keras as follows: ...
4
votes
1answer
309 views

How can I detect partially obscured objects using Python?

I'm building a computer vision application using Python (OpenCV, keras-retinanet, tensorflow) which requires detecting an object and then counting how many objects are behind that front object. So, ...
4
votes
0answers
1k views

Using the Python Keras multi_gpu_model with LSTM / GRU to predict Timeseries data

I'm having an issue with python keras LSTM / GRU layers with multi_gpu_model for machine learning. When I use a single GPU, the predictions work correctly ...
4
votes
0answers
1k views

Keras objective function shared between outputs

Is there any way to implement a loss function that is shared between outputs? I have a 2D image output and scalar classification that are both used by a single loss function. I have attempted writing ...
4
votes
2answers
478 views

How to determine the number of the training images in Keras after data augmentaion?

I want to create a CNN model and I am using data augmentation. I want know the number of augmented images in Keras. How to determine the number of the training images in Keras after data augmentation?...
3
votes
0answers
34 views

Train NN for balanced accuracy

I'm trying to get a NN (a CNN, to be precise) to predict labels on hugely imbalanced data, i.e. some classes are much bigger than others. I want to optimize the balanced accuracy. So I give the class ...
3
votes
2answers
118 views

What's the difference between GridSearchCrossValidation score and score on testset?

I'm doing classification using python. I'm using the class GridSearchCV, this class has the attribute best_score_ defined as "Mean cross-validated score of the best_estimator". With this ...
3
votes
1answer
51 views

Chossing between regression models

This is the first time I attempt to use machine learning with Keras. In contrast to others I need to use one of the disadvantage of such algorithms. I need a ...
3
votes
1answer
426 views

What is the better way to predict classes for the models developed using the functional API in Keras

We can predict the class for new data instances using the Sequential classification model in Keras using the predict_classes() function. What is the way to predict the class for models that developed ...
3
votes
1answer
540 views

Difference between tf.keras.backend.one_hot and keras.utils.to_categorical

I'm working on a classification project and need to do one hot encoding on my data set. I'm just wondering what is the difference between tf.keras.backend.one_hot ...
3
votes
0answers
186 views

Chess deep learning siamese network overfitting when shouldn't in theory

TLDR: My network is training with pairs so instead of 10^6 samples it has 10^12 samples (The number of samples squared) . With that large of a data set is shouldn't overfit but it does after very few ...
3
votes
0answers
82 views

Help understanding the Tensorboard histogram names and meaning in an LSTM Model

Can someone please help me understand what the names and shapes of the following tensorboard histogram outputs mean about an LSTM model I coded? Thank you! I understand the terms in the names like ...
3
votes
2answers
929 views

Keypoint detection from an image using a neural network

I am trying to design and train a neural network, which would be able to give me coordinates of certain key points in the image. Dataset I've got a dataset containing 1800 images similar to these: ...
3
votes
0answers
51 views

How to create anchor-positive and anchor-negative pair for feature X in a signature data set for training Siamese network

How to create anchor-positive and anchor-negative pair for feature X in a signature data set for training Siamese network? Im have a cedar signature data set with 55 peoples signatures(classes) with ...
3
votes
0answers
90 views

Unable to transform (greatly performing) Autoencoder into Variational Autoencoder

Following the procedure described in this SO question, I am trying to transform my (greatly performing) convolutional Autoencoder into a Variational version of the same Autoencoder. As explained in ...
3
votes
1answer
3k views

Making predictions / Loading model in TensorFlow 2.0

I use TensorFlow/Keras on a daily basis to make predictions for a project. Everything works fine but I was getting regular warnings about the transition to TensorFlow 2.0 and I thought this week I ...
3
votes
2answers
90 views

How can we create an label, value detector?

I am trying to implement an text detector using MaskRCNN such that the model detects the label and value as shown in the image below. Detecting the same is easier for fields like page date and order ...
3
votes
1answer
1k views

Running out of memory when training Keras LSTM model for binary classification on image sequences

I'm trying to come up with a Keras model based on LSTM layers that would do binary classification on image sequences. The input data has the following shape: ...
3
votes
0answers
48 views

Keras model with second to last sigmoid activated Conv1D layer followed by globalMaxPool outputs values outside [0,1]. Why?

I am trying to train a binary classifier. It is a residual network with skip layers etc. but ultimately, the bottom two layers are a 1D convolution with sigmoid activation followed by a global max ...
3
votes
1answer
101 views

How to get the number of steps until a certain accuracy in keras?

I want to see how many steps does it take for my model to reach a certain accuracy.Say 90 percent on cifar10.How can I get this info from the keras model ? EDIT: accuracy in each epoch is accessible ...
3
votes
0answers
139 views

Neural networks (keras): predicting a periodic output array

I have a non-linear multiple regression problem where my target arrays have a length of 256 (for a single sample). These arrays have a periodic structure, since it's actually composed of 16 semi-...
3
votes
0answers
34 views

Keras 'cross section' model with time trend

Problem: I have a problem in which cross-sectional features (X) explain a continuous outcome (y). In addition, there is a linear time trend (t) in the data. Using OLS, such a model would write: $y = ...
3
votes
0answers
1k views

One hot encoding as input to recurrent neural networks

I'm trying to predict next label in a pattern based on previous labels using recurrent neural network. In total I have 100 labels Example of input pattern: ...
3
votes
0answers
425 views

Embedding variable length “multi-hot-encoded” features

How can I implement an embedding layer in Keras that takes in an input that could have a variable length? For instance, if the vocabulary was 10-long I could have inputs like: ...
3
votes
0answers
179 views

Why does my model only converge when I add a MaxPooling with stride of 1 layer at the beginning?

I have a model that takes an input of inertial sensor data collected at 60 hertz and outputs one of two classes. I have broken the data into 1 min snapshots which seems to be appropriate. I have split ...
3
votes
0answers
309 views

Grouping the Input Features for LSTM (keras)

When I have a input feature of 2-dimension (variable*feature), is it still good to flatten them into 1-dimension input ...
3
votes
0answers
326 views

Knowing when a GAN is overfitting (sequence classification study)

I have sequences of long, sparse 1_D vectors (3000 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 ...
3
votes
0answers
236 views

convLSTM : how to structure input data

I have the following dataframe containing training data that I have been using to perform a regression task using CNN + FC : ...
3
votes
0answers
878 views

Multi label classification and sigmoid function

I'm new to neural networks so this may be silly question. I have build standard CNN network for image classification. I want multi-label classification network so I use binary_crossentropy as loss ...
3
votes
2answers
2k views

what happens to the depth channels when convolved by multiple filters in a cnn (keras, tensorflow)

I have a $15$-channel time series that I want to convolve using a $1$d CNN ($1\times n$ time-steps kernel). Now, let's say I want to have, as my first layer, $16$ filters. This would imply to my mind ...
3
votes
1answer
3k views

ValueError: Numpy arrays that you are passing to your model is not the size the model expected

I am trying to perform concatenation on the Bidirectinal LSTM layer. I have my model defined like this: ...
3
votes
0answers
1k views

Cross validation for convolutional neural network

I am using Keras to create a CNN model, and I would to use K-fold cross-validation to train the dataset. The dataset contains images and I am using ...
3
votes
0answers
359 views

Convolutional neural network with cross validation in Keras

I want to use K-fold cross-validation on my dataset of images. I am reading the data (images) from a directory. How do I use cross validation with convolutional neural network in Keras?
3
votes
1answer
198 views

Benefits of using Deep Learning-specific hyperparameter optimization tools vs. sklearn?

There are quite a few library for hyperparameter optimization that are specific to Keras or other Deep Learning libraries, like Hyperas or Talos. My question is, what's the main benefit of using ...
3
votes
2answers
392 views

Best way to deploy and Schedule Deep Learning Model

I am looking for best way to deploy my Deep Learning application which does the following: Fetches data from BigQuery Finds ...
3
votes
1answer
55 views

How can I know the name of the features selected by a Deep Belief Network?

I want to use DBN to reduce the 41 features of nslkdd dataset after transforming nominal data to numeric the number of features increases from 41 to 121 . I used 3 RBMs (121-50-10) now I want to know ...

1
2 3 4 5
20