Keras Tensorboard callback stops working after a couple thousand batches The 2019 Stack Overflow Developer Survey Results Are InTrain on batches in TensorflowKeras or TensorFlow Examples for Working with Large Text Datasets (~10M Sentences)Keras Callback example for saving a model after every epoch?Keras/Theano custom loss calculation - working with tensorsModel Parallelism not working? Inception v3 with keras and tensorflowDisplay images after augmentation in Keraskeras' ModelCheckpoint not workingWhy is my Keras model not learning image segmentation?Deep learning: Training in batchesHow to split a keras model into submodels after it's created

What is the motivation for a law requiring 2 parties to consent for recording a conversation

How can I make payments on the Internet without leaving a money trail?

How to Override Magento 2 vendor files

On the insanity of kings as an argument against monarchy

Are USB sockets on wall outlets live all the time, even when the switch is off?

Differentiate between line ending within polygon and line passing all the way through polygon - QGIS

If the Wish spell is used to duplicate the effect of Simulacrum, are existing duplicates destroyed?

"as much details as you can remember"

Process LaTeX code only if package is loaded

Geography at the pixel level

Can I connect a DC high voltage booster directly to my Raspberry Pi?

Dual Citizen. Exited the US on Italian passport recently

Falsification in Math vs Science

How to manage monthly salary

What is the purpose of the constant in the probability density function

Which Sci-Fi work first showed weapon of galactic-scale mass destruction?

Can the Protection from Evil and Good spell be used on the caster?

Must numeric JSON keys be quoted?

What tool would a Roman-age civilization have to grind silver and other metals into dust?

Not able to paste multiple components

How can I fix this gap between bookcases I made?

Is three citations per paragraph excessive for undergraduate research paper?

Flying Bloodthirsty Lampshades

What do hard-Brexiteers want with respect to the Irish border?



Keras Tensorboard callback stops working after a couple thousand batches



The 2019 Stack Overflow Developer Survey Results Are InTrain on batches in TensorflowKeras or TensorFlow Examples for Working with Large Text Datasets (~10M Sentences)Keras Callback example for saving a model after every epoch?Keras/Theano custom loss calculation - working with tensorsModel Parallelism not working? Inception v3 with keras and tensorflowDisplay images after augmentation in Keraskeras' ModelCheckpoint not workingWhy is my Keras model not learning image segmentation?Deep learning: Training in batchesHow to split a keras model into submodels after it's created










0












$begingroup$


I'm training a model using Keras, and I've written a custom callback, F1Metrics that computes the average F1 score every 1200 batches. In the callback, I write the score to a file, and also append it to the logs of the model, to be later displayed with Tensorboard.



F1Metrics.on_batch_end:



def on_batch_end(self, batch, logs=):
if not self.batch_save:
return

self.batch += 1

if self.batch == 0:
return

if self.batch % self.N != 0:
return

df, val_loss = self.calculate_metrics_table(
self.model,
self.labels,
self.number_of_classes,
self.generator,
'ep0_b1'.format(self.epoch, batch),
val_loss_fct=self.val_loss_fct,
loss=logs['loss'],
class_names=self.class_names,
)

df.to_csv(
os.path.join(
self.output_path,
'f1_metrics_epoch_0_batch_1_var_thresh.csv'.format(
self.epoch, batch)),
index=False)

logs['AUC'] = df['AUC'].mean()
logs['valid_val_loss'] = val_loss


Tensorboard callback:



tensorboard = TensorBoard(
log_dir=str(model_logs_output_dir),
batch_size = hyperparameters['batch_size'],
histogram_freq=0,
update_freq=hyperparameters['batch_size']*hyperparameters['batch_interval'],
)


The files are created for the entire duration of the training. But after ~25k batches, the updated value stops being recorded and displayed by Tensorboard, as seen below. The batch loss I assume is being calculated by Keras.



Tensorboard logs



Do you have any idea why this happens?










share|improve this question









$endgroup$
















    0












    $begingroup$


    I'm training a model using Keras, and I've written a custom callback, F1Metrics that computes the average F1 score every 1200 batches. In the callback, I write the score to a file, and also append it to the logs of the model, to be later displayed with Tensorboard.



    F1Metrics.on_batch_end:



    def on_batch_end(self, batch, logs=):
    if not self.batch_save:
    return

    self.batch += 1

    if self.batch == 0:
    return

    if self.batch % self.N != 0:
    return

    df, val_loss = self.calculate_metrics_table(
    self.model,
    self.labels,
    self.number_of_classes,
    self.generator,
    'ep0_b1'.format(self.epoch, batch),
    val_loss_fct=self.val_loss_fct,
    loss=logs['loss'],
    class_names=self.class_names,
    )

    df.to_csv(
    os.path.join(
    self.output_path,
    'f1_metrics_epoch_0_batch_1_var_thresh.csv'.format(
    self.epoch, batch)),
    index=False)

    logs['AUC'] = df['AUC'].mean()
    logs['valid_val_loss'] = val_loss


    Tensorboard callback:



    tensorboard = TensorBoard(
    log_dir=str(model_logs_output_dir),
    batch_size = hyperparameters['batch_size'],
    histogram_freq=0,
    update_freq=hyperparameters['batch_size']*hyperparameters['batch_interval'],
    )


    The files are created for the entire duration of the training. But after ~25k batches, the updated value stops being recorded and displayed by Tensorboard, as seen below. The batch loss I assume is being calculated by Keras.



    Tensorboard logs



    Do you have any idea why this happens?










    share|improve this question









    $endgroup$














      0












      0








      0





      $begingroup$


      I'm training a model using Keras, and I've written a custom callback, F1Metrics that computes the average F1 score every 1200 batches. In the callback, I write the score to a file, and also append it to the logs of the model, to be later displayed with Tensorboard.



      F1Metrics.on_batch_end:



      def on_batch_end(self, batch, logs=):
      if not self.batch_save:
      return

      self.batch += 1

      if self.batch == 0:
      return

      if self.batch % self.N != 0:
      return

      df, val_loss = self.calculate_metrics_table(
      self.model,
      self.labels,
      self.number_of_classes,
      self.generator,
      'ep0_b1'.format(self.epoch, batch),
      val_loss_fct=self.val_loss_fct,
      loss=logs['loss'],
      class_names=self.class_names,
      )

      df.to_csv(
      os.path.join(
      self.output_path,
      'f1_metrics_epoch_0_batch_1_var_thresh.csv'.format(
      self.epoch, batch)),
      index=False)

      logs['AUC'] = df['AUC'].mean()
      logs['valid_val_loss'] = val_loss


      Tensorboard callback:



      tensorboard = TensorBoard(
      log_dir=str(model_logs_output_dir),
      batch_size = hyperparameters['batch_size'],
      histogram_freq=0,
      update_freq=hyperparameters['batch_size']*hyperparameters['batch_interval'],
      )


      The files are created for the entire duration of the training. But after ~25k batches, the updated value stops being recorded and displayed by Tensorboard, as seen below. The batch loss I assume is being calculated by Keras.



      Tensorboard logs



      Do you have any idea why this happens?










      share|improve this question









      $endgroup$




      I'm training a model using Keras, and I've written a custom callback, F1Metrics that computes the average F1 score every 1200 batches. In the callback, I write the score to a file, and also append it to the logs of the model, to be later displayed with Tensorboard.



      F1Metrics.on_batch_end:



      def on_batch_end(self, batch, logs=):
      if not self.batch_save:
      return

      self.batch += 1

      if self.batch == 0:
      return

      if self.batch % self.N != 0:
      return

      df, val_loss = self.calculate_metrics_table(
      self.model,
      self.labels,
      self.number_of_classes,
      self.generator,
      'ep0_b1'.format(self.epoch, batch),
      val_loss_fct=self.val_loss_fct,
      loss=logs['loss'],
      class_names=self.class_names,
      )

      df.to_csv(
      os.path.join(
      self.output_path,
      'f1_metrics_epoch_0_batch_1_var_thresh.csv'.format(
      self.epoch, batch)),
      index=False)

      logs['AUC'] = df['AUC'].mean()
      logs['valid_val_loss'] = val_loss


      Tensorboard callback:



      tensorboard = TensorBoard(
      log_dir=str(model_logs_output_dir),
      batch_size = hyperparameters['batch_size'],
      histogram_freq=0,
      update_freq=hyperparameters['batch_size']*hyperparameters['batch_interval'],
      )


      The files are created for the entire duration of the training. But after ~25k batches, the updated value stops being recorded and displayed by Tensorboard, as seen below. The batch loss I assume is being calculated by Keras.



      Tensorboard logs



      Do you have any idea why this happens?







      keras tensorflow






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 29 at 11:56









      Tenescu AndreiTenescu Andrei

      113




      113




















          0






          active

          oldest

          votes












          Your Answer





          StackExchange.ifUsing("editor", function ()
          return StackExchange.using("mathjaxEditing", function ()
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
          );
          );
          , "mathjax-editing");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "557"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f48214%2fkeras-tensorboard-callback-stops-working-after-a-couple-thousand-batches%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Data Science Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f48214%2fkeras-tensorboard-callback-stops-working-after-a-couple-thousand-batches%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Adding axes to figuresAdding axes labels to LaTeX figuresLaTeX equivalent of ConTeXt buffersRotate a node but not its content: the case of the ellipse decorationHow to define the default vertical distance between nodes?TikZ scaling graphic and adjust node position and keep font sizeNumerical conditional within tikz keys?adding axes to shapesAlign axes across subfiguresAdding figures with a certain orderLine up nested tikz enviroments or how to get rid of themAdding axes labels to LaTeX figures

          Tähtien Talli Jäsenet | Lähteet | NavigointivalikkoSuomen Hippos – Tähtien Talli

          Do these cracks on my tires look bad? The Next CEO of Stack OverflowDry rot tire should I replace?Having to replace tiresFishtailed so easily? Bad tires? ABS?Filling the tires with something other than air, to avoid puncture hassles?Used Michelin tires safe to install?Do these tyre cracks necessitate replacement?Rumbling noise: tires or mechanicalIs it possible to fix noisy feathered tires?Are bad winter tires still better than summer tires in winter?Torque converter failure - Related to replacing only 2 tires?Why use snow tires on all 4 wheels on 2-wheel-drive cars?