tensorboard steps limit to 40?












0














I'm using keras 2.24 + tensorflow (1.12.0) to evaluate my learning experiments. I have a custom Tensorboard class inherited from keras.callbacks.TensorBoard to add in summary images to tensorboard. However, it seems that I can only visualize up to 40 epochs when I have already trained to 90~ epochs? Is this a limitation of tensorboard itself (do I have to change some settings to see data of latter epochs?) or is there something wrong with my Tensorboard code?



enter image description hereenter image description here



class MaskImageTensorBoard(TensorBoard):
def __init__(self, target_size, image_every_x_epochs, output_name, log_dir, data_vis_dir, **kwargs):
self.save_freq = image_every_x_epochs
self.output_name = output_name
self.data_vis_dir = data_vis_dir
self.target_size = target_size
super(MaskImageTensorBoard, self).__init__(log_dir, **kwargs)

def _load_images(self, image_list):
image_arr =
for f in image_list:
img = Image.open(f).resize((self.target_size[1], self.target_size[0]), Image.ANTIALIAS)
image_arr.append(np.array(img))
return np.array(image_arr)


def on_epoch_end(self, epoch, logs=None):
limit = 5
threshold = 0.5
color = [0, 255, 0]

if epoch % self.save_freq == 0:
image_list = [os.path.join(self.data_vis_dir, f) for f in random.sample(os.listdir(self.data_vis_dir), limit )]
images = self._load_images(image_list)
images2 = images / 255.
predictions = K.get_session().run(self.model.output, feed_dict = {self.model.input : images2})

predictions[predictions >= threshold] = 1
predictions[predictions < threshold] = 0 #shape [5, h, w, 1]
mask = np.apply_along_axis(lambda channel: np.concatenate([channel, channel, channel], axis=-1), 3, predictions)
mask *= color

masked_img = 0.5 * images + 0.5 * mask
masked_tensor = tf.convert_to_tensor(masked_img)
summ = tf.summary.image("Validation epoch {}".format(epoch), masked_tensor)
s = self.sess.run(summ)
self.writer.add_summary(s)

super(MaskImageTensorBoard, self).on_epoch_end(epoch, logs)









share|improve this question



























    0














    I'm using keras 2.24 + tensorflow (1.12.0) to evaluate my learning experiments. I have a custom Tensorboard class inherited from keras.callbacks.TensorBoard to add in summary images to tensorboard. However, it seems that I can only visualize up to 40 epochs when I have already trained to 90~ epochs? Is this a limitation of tensorboard itself (do I have to change some settings to see data of latter epochs?) or is there something wrong with my Tensorboard code?



    enter image description hereenter image description here



    class MaskImageTensorBoard(TensorBoard):
    def __init__(self, target_size, image_every_x_epochs, output_name, log_dir, data_vis_dir, **kwargs):
    self.save_freq = image_every_x_epochs
    self.output_name = output_name
    self.data_vis_dir = data_vis_dir
    self.target_size = target_size
    super(MaskImageTensorBoard, self).__init__(log_dir, **kwargs)

    def _load_images(self, image_list):
    image_arr =
    for f in image_list:
    img = Image.open(f).resize((self.target_size[1], self.target_size[0]), Image.ANTIALIAS)
    image_arr.append(np.array(img))
    return np.array(image_arr)


    def on_epoch_end(self, epoch, logs=None):
    limit = 5
    threshold = 0.5
    color = [0, 255, 0]

    if epoch % self.save_freq == 0:
    image_list = [os.path.join(self.data_vis_dir, f) for f in random.sample(os.listdir(self.data_vis_dir), limit )]
    images = self._load_images(image_list)
    images2 = images / 255.
    predictions = K.get_session().run(self.model.output, feed_dict = {self.model.input : images2})

    predictions[predictions >= threshold] = 1
    predictions[predictions < threshold] = 0 #shape [5, h, w, 1]
    mask = np.apply_along_axis(lambda channel: np.concatenate([channel, channel, channel], axis=-1), 3, predictions)
    mask *= color

    masked_img = 0.5 * images + 0.5 * mask
    masked_tensor = tf.convert_to_tensor(masked_img)
    summ = tf.summary.image("Validation epoch {}".format(epoch), masked_tensor)
    s = self.sess.run(summ)
    self.writer.add_summary(s)

    super(MaskImageTensorBoard, self).on_epoch_end(epoch, logs)









    share|improve this question

























      0












      0








      0







      I'm using keras 2.24 + tensorflow (1.12.0) to evaluate my learning experiments. I have a custom Tensorboard class inherited from keras.callbacks.TensorBoard to add in summary images to tensorboard. However, it seems that I can only visualize up to 40 epochs when I have already trained to 90~ epochs? Is this a limitation of tensorboard itself (do I have to change some settings to see data of latter epochs?) or is there something wrong with my Tensorboard code?



      enter image description hereenter image description here



      class MaskImageTensorBoard(TensorBoard):
      def __init__(self, target_size, image_every_x_epochs, output_name, log_dir, data_vis_dir, **kwargs):
      self.save_freq = image_every_x_epochs
      self.output_name = output_name
      self.data_vis_dir = data_vis_dir
      self.target_size = target_size
      super(MaskImageTensorBoard, self).__init__(log_dir, **kwargs)

      def _load_images(self, image_list):
      image_arr =
      for f in image_list:
      img = Image.open(f).resize((self.target_size[1], self.target_size[0]), Image.ANTIALIAS)
      image_arr.append(np.array(img))
      return np.array(image_arr)


      def on_epoch_end(self, epoch, logs=None):
      limit = 5
      threshold = 0.5
      color = [0, 255, 0]

      if epoch % self.save_freq == 0:
      image_list = [os.path.join(self.data_vis_dir, f) for f in random.sample(os.listdir(self.data_vis_dir), limit )]
      images = self._load_images(image_list)
      images2 = images / 255.
      predictions = K.get_session().run(self.model.output, feed_dict = {self.model.input : images2})

      predictions[predictions >= threshold] = 1
      predictions[predictions < threshold] = 0 #shape [5, h, w, 1]
      mask = np.apply_along_axis(lambda channel: np.concatenate([channel, channel, channel], axis=-1), 3, predictions)
      mask *= color

      masked_img = 0.5 * images + 0.5 * mask
      masked_tensor = tf.convert_to_tensor(masked_img)
      summ = tf.summary.image("Validation epoch {}".format(epoch), masked_tensor)
      s = self.sess.run(summ)
      self.writer.add_summary(s)

      super(MaskImageTensorBoard, self).on_epoch_end(epoch, logs)









      share|improve this question













      I'm using keras 2.24 + tensorflow (1.12.0) to evaluate my learning experiments. I have a custom Tensorboard class inherited from keras.callbacks.TensorBoard to add in summary images to tensorboard. However, it seems that I can only visualize up to 40 epochs when I have already trained to 90~ epochs? Is this a limitation of tensorboard itself (do I have to change some settings to see data of latter epochs?) or is there something wrong with my Tensorboard code?



      enter image description hereenter image description here



      class MaskImageTensorBoard(TensorBoard):
      def __init__(self, target_size, image_every_x_epochs, output_name, log_dir, data_vis_dir, **kwargs):
      self.save_freq = image_every_x_epochs
      self.output_name = output_name
      self.data_vis_dir = data_vis_dir
      self.target_size = target_size
      super(MaskImageTensorBoard, self).__init__(log_dir, **kwargs)

      def _load_images(self, image_list):
      image_arr =
      for f in image_list:
      img = Image.open(f).resize((self.target_size[1], self.target_size[0]), Image.ANTIALIAS)
      image_arr.append(np.array(img))
      return np.array(image_arr)


      def on_epoch_end(self, epoch, logs=None):
      limit = 5
      threshold = 0.5
      color = [0, 255, 0]

      if epoch % self.save_freq == 0:
      image_list = [os.path.join(self.data_vis_dir, f) for f in random.sample(os.listdir(self.data_vis_dir), limit )]
      images = self._load_images(image_list)
      images2 = images / 255.
      predictions = K.get_session().run(self.model.output, feed_dict = {self.model.input : images2})

      predictions[predictions >= threshold] = 1
      predictions[predictions < threshold] = 0 #shape [5, h, w, 1]
      mask = np.apply_along_axis(lambda channel: np.concatenate([channel, channel, channel], axis=-1), 3, predictions)
      mask *= color

      masked_img = 0.5 * images + 0.5 * mask
      masked_tensor = tf.convert_to_tensor(masked_img)
      summ = tf.summary.image("Validation epoch {}".format(epoch), masked_tensor)
      s = self.sess.run(summ)
      self.writer.add_summary(s)

      super(MaskImageTensorBoard, self).on_epoch_end(epoch, logs)






      tensorflow keras tensorboard






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Dec 28 '18 at 7:33









      avpavp

      163




      163
























          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          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: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          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%2fstackoverflow.com%2fquestions%2f53955136%2ftensorboard-steps-limit-to-40%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 Stack Overflow!


          • 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.


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





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • 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.


          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%2fstackoverflow.com%2fquestions%2f53955136%2ftensorboard-steps-limit-to-40%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

          Monofisismo

          Angular Downloading a file using contenturl with Basic Authentication

          Olmecas