what the bars in keras training show?

Issue I am using keras and part of my network and parameters are as follows: parser.add_argument(“–batch_size”, default=396, type=int, help=”batch size”) parser.add_argument(“–n_epochs”, default=10, type=int, help=”number of epoch”) parser.add_argument(“–epoch_steps”, default=10, type=int, help=”number of epoch step”) parser.add_argument(“–val_steps”, default=4, type=int, help=”number of valdation step”)

Continue reading

Can we use Keras model's accuracy metric for Image Captioning model?

Issue Kindly consider the following line of code. model.compile(loss=’categorical_crossentropy’, optimizer=’adam’,metrics=[‘accuracy’]) I am allowed to use metrics=[‘accuracy’] for my Image Captioning model. My model has been defined as follows: inputs1 = Input(shape=(2048,)) fe1 = Dropout(0.2)(inputs1) fe1=BatchNormalization()(fe1) fe2 = Dense(256, activation=’relu’)(fe1) inputs2

Continue reading

Weird behaviour for my CNN validation accuracy and loss function during training phase

Issue Here is the architecture of my network : cnn3 = Sequential() cnn3.add(Conv2D(32, kernel_size=(3, 3), activation=’relu’, input_shape=input_shape)) cnn3.add(MaxPooling2D((2, 2))) cnn3.add(Dropout(0.25)) cnn3.add(Conv2D(64, kernel_size=(3, 3), activation=’relu’)) cnn3.add(MaxPooling2D(pool_size=(2, 2))) cnn3.add(Dropout(0.25)) cnn3.add(Conv2D(128, kernel_size=(3, 3), activation=’relu’)) cnn3.add(Dropout(0.2)) cnn3.add(Flatten()) cnn3.add(Dense(128, activation=’relu’)) cnn3.add(Dropout(0.4)) # 0.3 cnn3.add(Dense(4, activation=’softmax’))

Continue reading

how to get history['val_accuracy'] from ImageDataGenerator

Issue I’m using keras.preprocessing.image.ImageDataGenerator When i fed it to model.fit like that history = model.fit( train_data_gen, epochs=EPOCHS, steps_per_epoch=steps_per_epoch, validation_data=val_data_gen, validation_freq=validation_freq, callbacks=[EarlyStopping(monitor=’val_accuracy’, patience=2)] ) it works fine, but there is no actual validation data, so my callback doesn’t work, as well

Continue reading

TimeDistributed layer

Issue sorry I’m new to keras and RNN in general. I have these data on which to make training. Shape of X_train=(n_steps=25, length_steps=3878, n_features=8), shape of y_train=(n_steps=25, n_features=4). Basically for each step with length 3878 and 8 features I have

Continue reading

Epochs and batches control in Keras

Issue I would like to implement an autoencoder model that acts as following: for epoch in xrange(100): for X_batch in batch_list: model.train_on_batch(X_batch, X_batch) training_error = model.evaluate(X_batch, X_batch, verbose=0) "average the training error by the number of the batches considered" "save

Continue reading

Can flow_from_directory get train and validation data from the same directory in Keras?

Issue I got the following example from here. train_datagen = ImageDataGenerator( rescale=1./255, shear_range=0.2, zoom_range=0.2, horizontal_flip=True) test_datagen = ImageDataGenerator(rescale=1./255) train_generator = train_datagen.flow_from_directory( ‘data/train’, target_size=(150, 150), batch_size=32, class_mode=’binary’) validation_generator = test_datagen.flow_from_directory( ‘data/validation’, target_size=(150, 150), batch_size=32, class_mode=’binary’) There are two separate directories for

Continue reading

Reshape the input for BatchDataset trained model

Issue I trained my tensorflow model on images after convert it to BatchDataset IMG_size = 224 INPUT_SHAPE = [None, IMG_size, IMG_size, 3] # 4D input model.fit(x=train_data, epochs=EPOCHES, validation_data=test_data, validation_freq=1, # check validation metrics every epoch callbacks=[tensorboard, early_stopping]) model.compile( loss=tf.keras.losses.CategoricalCrossentropy(), optimizer=tf.keras.optimizers.Adam(),

Continue reading