Questions tagged [keras-2]

with a new API.

Keras API will now become available directly as part of

264 questions
2
votes
1 answer

how to use model.fit in spatial pyramid pooling net with keras

SPP net is used for variable size input images. SPP Net implementation in keras in here uses two model.fit for two sizes of images. I have 278 images of all different sizes, so how to use model.fit in this case? and how keras calculating efficiency…
Hitesh
  • 1,285
  • 6
  • 20
  • 36
2
votes
2 answers

How to use Keras layers without making model

I want to use Keras layers pooling layers without making a model. Every time I see example related to Keras,I see them in model form, like as follows: model = Sequential() model.add(Conv2D(2, kernel_size=(3, 3),activation='relu', …
Hitesh
  • 1,285
  • 6
  • 20
  • 36
2
votes
1 answer

load_model error with "function=preprocess_input" in lambda layer (Keras)

keras 2.1.5 / TF backend I tried to use lambda layer to do image pre-process (via function) the model: from keras.applications.resnet50 import preprocess_input base_model = keras.applications.resnet50.ResNet50(include_top=False, input_shape=(224,…
Kai
  • 45
  • 1
  • 7
2
votes
1 answer

Conv1D convolutional Autoencoder for text in keras

How I solve this issue ValueError: Error when checking target: expected conv-decode3 to have shape (None, 14, 300) but got array with shape (6559, 16, 300) NUM_WORDS = 3 pool_size = 2 x = Input(shape=(16, 300), name="input") h = x h =…
Waseem Randhawa
  • 149
  • 2
  • 17
2
votes
1 answer

User Warning Form Keras 2

I'm trying to reproduce this work but I receive the following warning: /usr/local/lib/python3.5/dist-packages/ipykernel_launcher.py:2: UserWarning: Update your `Model` call to the Keras 2 API: `Model(outputs=Tensor("de...,…
Borhan Kazimipour
  • 405
  • 1
  • 6
  • 13
2
votes
1 answer

Multi-class multi-label classification in Keras

I am trying to train a multi-task multi-label classifier using Keras. The output layer is a fork of two outputs. The task of each output layer is to predict the categories of its task. The y vectors are OneHot encoded. I am using a custom…
Lilo
  • 640
  • 1
  • 9
  • 22
2
votes
1 answer

IoU keras (backend tensorflow) feed dict for placeholder error (tensor.eval()

I have error when I tried to create custom metric for keras (Intersection over union). I want to find intersection over union of two images (tensors) def IoU(y_true,y_pred): y_true_f = K.flatten(y_true) y_pred_f = K.flatten(y_pred) …
Saeed Alahmari
  • 843
  • 1
  • 7
  • 11
2
votes
1 answer

Speeding up loading a model in Keras?

Is there a way to speed up loading a model in Keras? I'm using a transfer-learned inception model. It seems to take 13 seconds to load a model from my experiences. I want to load deploy some models onto smart phones. Using Tensorflow as backend.…
Moondra
  • 4,399
  • 9
  • 46
  • 104
2
votes
1 answer

Training one model with several GPU's

How you can program keras or tensorflow to partitionate training on multiple GPU, let's say you are in an amaozn ec2 instance that has 8 GPU's and you want to use all of them to train faster, but your code is just for a single cpu or GPU ?
Hector Blandin
  • 158
  • 1
  • 12
2
votes
1 answer

How to write a Keras custom metric that filters or masks some values?

In Keras I'm trying to figure out how to calculate a custom metric or loss that filters out or masks some values so that they don't contribute to the returned value. I'm stuck on how to get a tensor slice or how to iterate with an if: over the…
2
votes
1 answer

Shape of image after MaxPooling2D with padding ='same' --calculating layer-by-layer shape in convolution autoencoder

Very briefly my question relates to image-size not remaining the same as the input image size after a maxpool layer when I use padding = 'same' in Keras code. I am going through the Keras blog: Building Autoencoders in Keras. I am building…
Ashok K Harnal
  • 1,191
  • 2
  • 15
  • 28
2
votes
1 answer

validation loss and validation data of multi-output model in Keras

I want to train a model with one input and two outputs in Keras, but I have a couple of issues with the setup of validations. 1) The Keras functional API documentation says that model.fit can take in a list of numpy arrays as output when there are…
aniromi
  • 95
  • 7
2
votes
0 answers

Keras metric produces infinite result in K.mean

EDIT: It was actually a divide-by-zero error. :( I created a metric function in Keras to calculate the average fractional error; that is, for each actual/predicted pair I calculate abs(actual - predicted)/actual, then find the mean across all the…
thornate
  • 4,902
  • 9
  • 39
  • 43
2
votes
1 answer

How do you use Add in Keras

In keras say you have layer1 and layer2 You want to add these two layers, and you have to use Add from keras.layers.merge and you can't use the functional api. Add doesn't take any inputs, so I don't see how it can possibly help in setting up the…
lars
  • 1,976
  • 5
  • 33
  • 47
2
votes
1 answer

2D Convolutional neural networks with variable size images

I have implemented a convolutional auto-encoder with Keras, using the Theano backend. I am changing my approach to try to deal with images of different sizes. As long as I use numpy's stack function to build the dataset (equal size images) I am…
rll
  • 5,509
  • 3
  • 31
  • 46