I am working on a sentence classification problem and try to solve using Keras.
The total unique words in the vocabulary is 36.
In this case, the total vocab is [W1,W2,W3....W36]
So, if I have a sentence with words as [W1 W2 W6 W7 W9], if I encode…
I want to use Keras ModelCheckpoint callback to monitor several parameters ( I have a multi-task network). Is it possible with just one callback ? Or do I need to do that in many callbacks ??
The ckechpoint creation :
checkpointer =…
I want to use the keras layer Flatten() or Reshape((-1,)) at the end of my model to output an 1D vector like [0,0,1,0,0, ... ,0,0,1,0].
Sadly there is an problem because of my unknown input shape which is: input_shape=(4, None, 1))).
So typically…
I'm using Keras 2.0.8 with Python 3 kernel in Jupyter Notebook. My backend is TensorFlow 1.3 and I'm developing on Mac.
Whenever I'm using fit_generator() I'm getting following…
I would like to implement an adversarial network with a classifier whose output is connected to an adversary that has to guess a specific feature of the inputs to the classifier (a nuisance parameter) based on the output of the classifier (a…
If I have a dataset
dataset = tf.keras.preprocessing.image_dataset_from_directory(
directory,
labels="inferred",
label_mode="int",
class_names=None,
color_mode="rgb",
batch_size=32,
image_size=(32, 32),
shuffle=True,
…
I am trying to implement this merge layer:
policy = merge([out1, out2], mode = lambda x: x[0]-K.mean(x[0])+x[1], output_shape = (out_node,))
However, "merge" is no longer present in Keras 2. You can only access public standarized "Merge" layers,…
I defined a custom loss function in Keras (tensorflow backend) that is comprised of reconstruction MSE and the kullback leibler divergence between the learned probability distribution and a standard normal distribution. (It is for a variational…
Problem
I want to train a keras2 neural network (theano backend) with data of variable relevance. That means some of the samples are less important than others. They shall affect the training less than others. However I'm not able to simply omit…
Maybe a very dumb question but I can't find an example how to use categorical_hinge in Keras. I do classification and my target is shape(,1) with values [-1,0,1] so I have 3 categories. Using the functional API I have set up my output layer like…
Every derived class of Layer class in keras has build() definition.
build() is place where we assign weights to the keras layer.
When is this function invoked internally? I am unable to find any piece of code which may be callling it
In __call_()…
I ran into some trouble when trying to save a Keras model:
Here is my code:
import h5py
from keras.models import load_model
try:
import h5py
print ('import fine')
except ImportError:
h5py = None
left.save('left.h5') # creates a HDF5…
I want to use bottlenecks for transfer learning using InceptionV3 in Keras.
I've used some of the tips on creating, loading and using bottlenecks from
https://blog.keras.io/building-powerful-image-classification-models-using-very-little-data.html
My…
I am trying to mask missing data from a Convolutional LSTM layer using Keras (2.0.6) with TensorFlow backend (1.2.1):
import keras
from keras.models import Sequential
from keras.layers import Masking, ConvLSTM2D
n_timesteps = 10
n_width =…
I'm working with Keras, and trying to create a Learning Rate Scheduler that schedules on the basis of number of batches processed, instead of number of epochs. To do this, I've inserted the scheduling code into the get_updates method of my…