Search code examples
pythontensorflowkerastensorboardautoencoder

Autoencoder , steps_per_epoch,What value should it contain?


I'm trying to create a stacked autoencoder with my own dataset ,evreything work great ,when i try to draw the curve with tensorboard i get this scalars:

enter image description here

i think the error is in steps_per_epoch if it's not X_train.shape[0] so what sould it contain:

autoencoder.fit_generator(generated_data.flow(X_train, X_train, batch_size=batch_size), steps_per_epoch=X_train.shape[0], epochs=epochs, validation_data=(X_test, X_test), callbacks=[TensorBoard(log_dir='/tmp/autoencoder')])

and the other thing how can i add Accuarcy ?


Solution

  • From the documentation of fit_generator

    steps_per_epoch: Integer. Total number of steps (batches of samples) to yield from generator before declaring one epoch finished and starting the next epoch. It should typically be equal to the number of samples of your dataset divided by the batch size. Optional for Sequence: if unspecified, will use the len(generator) as a number of steps.

    So you should set it roughly equal to X_train.shape[0]/batch_size

    To monitor accuracy use

    autoencoder.compile(optimizer='rmsprop', loss='mse', metrics=['mse', 'accuracy'])