Questions tagged [keras-2]

with a new API.

Keras API will now become available directly as part of

264 questions
0
votes
1 answer

Training Keras model without validation set and normalization of images

I'm using Keras on Python to train a CNN autoencoder. In the fit() method I have to provide validation_split or validation_data. First, I would like to use 80% of my data as training data and 20% as validation data (random split). As soon as I have…
machinery
  • 5,972
  • 12
  • 67
  • 118
0
votes
1 answer

Iterating over arrays on disk similar to ImageDataGenerator

I have 70'000 2D numpy arrays on which I would like to train a CNN network using Keras. Holding them in memory would be an option but would consume a lot of memory. Thus, I would like to save the matrices on disk and load them on runtime. One option…
machinery
  • 5,972
  • 12
  • 67
  • 118
0
votes
0 answers

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.totals[k] += v * batch_size 237 …
pythOnometrist
  • 6,531
  • 6
  • 30
  • 50
0
votes
0 answers

model gets correct input dimensions, but throws dimension error

Edit: Solved. Spelling mistake, see first comment I use a MobileNetV2 pretrained model in Keras2/TF2 My images are scaled to 224x224 I set the model input shape: input_shape=(224,224,3) Later I use ImageGenerator to create the images. Here I…
Florida Man
  • 2,021
  • 3
  • 25
  • 43
0
votes
1 answer

Keras 2.2.4 ERROR:AttributeError: 'NoneType' object has no attribute 'inbound_nodes'

I'm building a new channel wise operation for my network. A global average pooling result will multiply(element-wise) the first x(input) value. But, when i run the train.py file, it will occur errors which i couldn't understand. pls HELP!!! The…
0
votes
2 answers

Loss vs epoch plot in keras on time series forecasting

epoch vs loss plot I am getting above epoch vs loss plot while training on time series forecasting in keras 2.2.4. Model configuration 1 lstm layer, 1 dense layer, num epochs - 64. On some set of configuration I am getting right plot with just two…
cat
  • 31
  • 1
  • 7
0
votes
0 answers

keras : with session.graph.as_default(): AttributeError: 'NoneType' object has no attribute 'graph'

I am trying to run some code on Deep embedding clustering on mnist with the help of Keras , however, I get the following error from keras.datasets import mnist import numpy as np import keras.backend as K from keras.engine.topology import Layer,…
Hoda Fakharzadeh
  • 697
  • 3
  • 7
  • 18
0
votes
1 answer

Loading Keras dataset mnist

After installing keras gpu, I try the simple example: import keras print(keras.__version__) Prints the following output: 2.2.4 Using TensorFlow backend. However, when I try to load a dataset: form keras.datasets import mnist It gives an…
Ivan
  • 7,448
  • 14
  • 69
  • 134
0
votes
2 answers

Convert code to new keras version (functional API) or how to concatenate 2 models

Megre doesn't work anymore. I tried the new functional API (concatenate, add, multiply) but it doesn't work for models. How to implement it? lower_model = [self.build_network(self.model_config['critic_lower'], input_shape=(self.history_length,…
HNN
  • 39
  • 7
0
votes
1 answer

'Tensor' object has no attribute 'compile'

Following is the code snippet: merged_model = Sequential() merged_model = concatenate([model1.output, model2.output, model3.output, model4.output, model5.output]) x = BatchNormalization()(merged_model) x = Dense(300)(x) x =…
0
votes
0 answers

Use Merge in Keras 2.0

I have followed link : https://github.com/mayanksatnalika/ipython/blob/master/embeddings%20project/safe_driver/Safe_driver_Kaggle.ipynb but getting error NameError: name 'Merge' is not defined when i am running the following block : from…
ajaypr55
  • 141
  • 2
  • 11
0
votes
1 answer

Padding not being understood in the UpSampling2D layer of a sequential layer

I am building a CNN model with the sequential keras API but getting the following error on line 12 (model.add(UpSampling2D((2, 2), padding='same'))) TypeError: ('Keyword argument not understood:', 'padding') I am using Keras 2.2.4 and Tensorflow…
JayJay81
  • 203
  • 1
  • 8
0
votes
1 answer

Keras model: TypeError: can't pickle _thread.lock objects

I have trouble using a trained Keras model in PySpark. The following versions of libraries are used: tensorflow==1.1.0 h5py==2.7.0 keras==2.0.4 Also, I use Spark 2.4.0. from pyspark.sql import SparkSession import pyspark.sql.functions as func from…
ScalaBoy
  • 3,254
  • 13
  • 46
  • 84
0
votes
1 answer

Why deleting one dimension in tensor causes InvalidArgumentError: Matrix size-incompatible?

Part of my codes: reshape_out = Reshape((3, 21, 1), input_shape=(21*3,), name='reshape_to_3_21')(output3d) drop_out = Lambda(lambda x:x[0:2, :, :], output_shape=(2, 21, 1), name='projection')(reshape_out) flatten_out = Flatten()(drop_out) I got the…
BAE
  • 8,550
  • 22
  • 88
  • 171
0
votes
1 answer

@property: AttributeError: can't set attribute

I am trying this example and got the following error: --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) in…
BAE
  • 8,550
  • 22
  • 88
  • 171