Questions tagged [keras-2]

with a new API.

Keras API will now become available directly as part of

264 questions
2
votes
1 answer

Keras callbacks Tensorboard multi-output Error

I can't figure out what is causing this error for multi-output Keras Model when using callbacks.TensorBoard. tbCallBack = keras.callbacks.TensorBoard(log_dir = logdir, histogram_freq = 1, write_graph = 1, write_images = 0, write_grads = 1) ###No…
Roy
  • 45
  • 7
2
votes
0 answers

Keras implementation of skip-gram word embeddings is very slow

I am trying to train skip-gram word embeddings using the example posted at https://github.com/nzw0301/keras-examples/blob/master/Skip-gram-with-NS.ipynb on a GPU GeForce GTX 1080 using the english Wikipedia (~100M sentences). The training time is…
aelgohary
  • 21
  • 3
2
votes
1 answer

How to read multiple images in keras presented in a folder?

I want to read multiple images presented in folder and process them one after another continuously. I am using keras and theano as backend. How can I do that?
Rajesh
  • 221
  • 4
  • 16
1
vote
1 answer

How to fix "cannot import name '__version__' from 'tensorflow.keras'"?

Trying to import DQNAgent like this from rl.agents.dqn import DQNAgent I get the following error: cannot import name '__version__' from 'tensorflow.keras' The installed versions are: Tensorflow: 2.13.0, Keras: 2.13.1, Keras-rl2: 1.0.5 I am using…
scopchanov
  • 7,966
  • 10
  • 40
  • 68
1
vote
0 answers

load_model with a metric

I save a model with a metric I defined as it is done here . Were they do the following: def get_lr_metric(optimizer): def lr(y_true, y_pred): return optimizer.lr return lr optimizer = keras.optimizers.Adam() lr_metric =…
Ido
  • 65
  • 6
1
vote
1 answer

Tensorflow: How to use a generator for fit() which runs in parallel with multiple processes

I am trying to train a model on a data set which does not fit in my RAM. Therefore I am using a data generator which inherits from tensorflow.keras.utils.Sequence as shown below. This is working. However because I am doing processing on the images…
1
vote
1 answer

Regression with Keras API not giving consistent result

I am doing a comparative study on a simple regression (one independent variable and one target variable) in two ways:- LinearRegression vs neural network (NN - Keras API). My sample data as follows: x1 y 121.9114 121.856 121.856 …
1
vote
0 answers

TypeError: can't pickle _thread.RLock objects -- when trying to save experiments done with keras

I have run some experiments saved the results of each experiment in a dictionary and then stored the individual dictionaries in another dictionary. But I can not save this dictionary. Here is my code: def f_compile_fit_evaluate_model1(filters1,…
user8270077
  • 4,621
  • 17
  • 75
  • 140
1
vote
0 answers

implementing focal loss on large CNN

I have an image binary classification problem, with only 15% of the data from class 1, and 85% of it is from class 0. I decided to work with focal loss to deal with the unbalanced dataset and noticed something. When I use a fairly simple cnn, I see…
1
vote
1 answer

How to get the dictionary output from a generator, which outputs an array with a dictionary for custom keras image generator

I have a custom made generator to output multiple values to predict against. I'm trying to get the values to correspond to a given image, without success. Here is my output: e(array([[[[0., 0., 0.], [0., 0., 0.], [0., 0., 0.], …
Steve-0 Dev.
  • 1,008
  • 1
  • 7
  • 11
1
vote
1 answer

Python Keras LSTM 'ValueError: `start_index+length='

I am trying to implement Keras LSTM for the airpassenger dataset. It generates the following error. ValueError: `start_index+length=12 > end_index=11` is disallowed, as no part of the sequence would be left to be used as current step Here is what I…
Totura
  • 19
  • 1
  • 7
1
vote
1 answer

How to retrieve intermediate predictions results in a loop

Need to calculate time of the prediction results of each layer and pass the output of the model as an input to another layer. Treating each layer as a model and getting the intermediate results and passing those results to the next. When I try to…
user11549734
1
vote
2 answers

how to do custom keras layer matrix multiplication

Layers: Input shape (None,75) Hidden layer 1 - shape is (75,3) Hidden layer 2 - shape is (3,1) For the last layer, the output must be calculated as ( (H21*w1)*(H22*w2)*(H23*w3)), where H21,H22,H23 will be the outcome of Hidden layer 2, and…
1
vote
0 answers

Keras predict diabetic retiopathy

I'm trying to predict a diabetic retiopathy by using densenet121 model from keras. I have a 5 folder that contain 0:3647 images 1:750 images 2:1105 images 3:305 images 4:193 images train data have 6000 image and validate data have 1000 image and…
Newturno
  • 11
  • 4
1
vote
1 answer

Loading ensemble keras model gives ValueError: Invalid input_shape argument (None, 224, 224, 3): model has 0 tensor inputs

My model is an ensemble of 2 different keras models, the models are connected to same input layer and have 2 output layers when combined. Both models are pretrained and I am trying to create a parallel architecture. My architecture is…
SajanGohil
  • 960
  • 13
  • 26