Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

190
Visualizações
TensorBoard Distributions and Histograms with Keras and fit_generator

I'm using Keras to train a CNN using the fit_generator function.

It seems to be a known issue that TensorBoard doesn't show histograms and distributions in this setup.

Did anybody figure out a way to make it work anyway?

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

There is no easy way to just plug it in with one line of code, you have to write your summaries by hand.

The good news is that it's not difficult and you can use the TensorBoard callback code in Keras as a reference. (There is also a version 2 ready for TensorFlow 2.x.)

Basically, write a function e.g. write_summaries(model) and call it whenever you want to write your summaries (e.g. just after your fit_generator())

Inside your write_summaries(model) function use tf.summary, histogram_summary and other summary functions to log data you want to see on tensorboard.

If you don't know exactly how to check official tutorial: and this great example of MNIST with summaries.

over 4 years ago · Santiago Trujillo Relatório

0

I believe bartgras's explanation is superseded in more recent versions of Keras (I'm using Keras 2.2.2). To get histograms in Tensorboard all I did was the following, (where bg is a data wrangling class which exposes a generator for gb.training_batch(); gb.validation_batch() however is NOT a generator):

NAME = "Foo_{}".format(datetime.now().isoformat(timespec='seconds')).replace(':', '-')

tensorboard = keras.callbacks.TensorBoard(
    log_dir="logs/{}".format(NAME),
    histogram_freq=1,
    write_images=True)

callbacks = [
    tensorboard
]

history = model.fit_generator(
    bg.training_batch(),
    validation_data=bg.validation_batch(),
    epochs=EPOCHS,
    steps_per_epoch=bg.steps_per_epoch,
    validation_steps=bg.validation_steps,
    verbose=1,
    shuffle=False,
    callbacks=callbacks)
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda