Tensorboard does not show any scalar summary from estimatorUsing make_template() in TensorFlowTensorflow tf.contrib.learn.DNNClassifer estimation accuracy does not align to DNNClassifier prediction accuracyHow to get train loss and evaluate loss every global step in Tensorflow Estimator?error image labeling after training'DataFrame' object has no attribute 'train'How to calculate median in eval_metric_ops?accuracy metric in custom estimatorFailedPreconditionError: Attempting to use uninitialized value Wtensorflow estimator LinearRegressor: why is my loss so bigWhy is the weight_column in Estimator affecting evaluation?

When does WordPress.org notify sites of new version?

Employee is self-centered and affects the team negatively

Gift for mentor after his thesis defense?

Crime rates in a post-scarcity economy

Concatenate all values of the same XML element using XPath/XQuery

Assuming a normal distribution: what is the sd for a given mean?

Appropriate age to involve kids in life changing decisions

How to increase row height of a table and vertically "align middle"?

Why was Gemini VIII terminated after recovering from the OAMS thruster failure?

Did Ham the Chimp follow commands, or did he just randomly push levers?

How does "politician" work as a job/career?

A♭ major 9th chord in Bach is unexpectedly dissonant/jazzy

How to get the decimal part of a number in apex

Why can’t you see at the start of the Big Bang?

Did any early RISC OS precursor run on the BBC Micro?

Why always 4...dxc6 and not 4...bxc6 in the Ruy Lopez Exchange?

Range hood vents into crawl space

How does jetBlue determine its boarding order?

call() a function within its own context

And now you see it

Convert Numbers To Emoji Math

Bash prompt takes only the first word of a hostname before the dot

My C Drive is full without reason

Latex editor/compiler for Windows and Powerpoint



Tensorboard does not show any scalar summary from estimator


Using make_template() in TensorFlowTensorflow tf.contrib.learn.DNNClassifer estimation accuracy does not align to DNNClassifier prediction accuracyHow to get train loss and evaluate loss every global step in Tensorflow Estimator?error image labeling after training'DataFrame' object has no attribute 'train'How to calculate median in eval_metric_ops?accuracy metric in custom estimatorFailedPreconditionError: Attempting to use uninitialized value Wtensorflow estimator LinearRegressor: why is my loss so bigWhy is the weight_column in Estimator affecting evaluation?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















Following the instructions on tf custom estimator



I have created a cnn estimator and tried to train it. While training, i initialized tensorboard and was hoping to see some visualizations about training steps. However, tensorboard only showed the graph of my custom estimator but none of the scalar values i have defined.



Here's roughly what I have in code



def model_fn(features, labels, mode, params=None):
tf.logging.set_verbosity(tf.logging.INFO)
n_classes = params['n_classes']
base_learning_rate = params['learning_rate']
decay_rate = params['decay_rate']
embedding_dim = params['embedding_dim']

x = VGG_block1(features, (3, 3), 64, name='block1_1')
x = VGG_block1(x, (3, 3), 128, name='block1_2')
x = VGG_block1(x, (3, 3), 256, name='block1_3', regularizer=tf.contrib.layers.l1_regularizer(.1))
x = VGG_block2(x, (3, 3), 512, name='block2_4')
x = VGG_block2(x, (3, 3), 1024, name='block2_5')
x = conv2d(x, 512, (5, 5), padding='valid', normalizer_fn=batch_norm, activation_fn=tf.nn.leaky_relu,
weights_initializer=he_uniform())
x = flatten(x)
embedding = fully_connected(x, embedding_dim)
logits = fully_connected(embedding, n_classes)

# make predictions
predictions =
'classes': tf.argmax(logits, axis=1, name='classes'),
'probabilities': tf.nn.softmax(logits, name='softmax'),
'embeddings':embedding


# if we are in prediction mode
if mode == tf.estimator.ModeKeys.PREDICT:
return tf.estimator.EstimatorSpec(mode=mode, predictions=predictions)

# otherwise define losses for training
c_loss, center = center_loss(embedding, labels, .9, n_classes)
xent_loss = tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(labels=labels, logits=logits))
total_loss = xent_loss + 0.5 * c_loss

# evaluation methods
accuracy, update_op = tf.metrics.accuracy(labels=labels, predictions=predictions['classes'], name='accuracy')
batch_acc = tf.reduce_mean(tf.cast(tf.equal(tf.cast(labels, tf.int64), predictions['classes']), tf.float32))
tf.summary.scalar('batch_acc', batch_acc)
tf.summary.scalar('streaming_acc', update_op)
tf.summary.scalar('total_loss', total_loss)
tf.summary.scalar('center_loss', c_loss)
tf.summary.scalar('xent_loss', xent_loss)

# training mode
if mode == tf.estimator.ModeKeys.TRAIN:
update_ops = tf.get_collection(tf.GraphKeys.UPDATE_OPS)
global_step = tf.Variable(0, trainable=False)
global_step_op = tf.assign(global_step, global_step + 1)
learning_rate = tf.train.exponential_decay(base_learning_rate, global_step, 8000, decay_rate, staircase=True)
optimizer = tf.train.AdamOptimizer(learning_rate)
with tf.control_dependencies(update_ops+[global_step_op]):
objective = optimizer.minimize(total_loss)

return tf.estimator.EstimatorSpec(mode=mode, loss=total_loss, train_op=objective)

eval_metric_ops =
'accuracy': (accuracy, update_op)

return tf.estimator.EstimatorSpec(mode=mode, loss=total_loss, eval_metric_ops=eval_metric_ops)

X_train, X_test, y_train, y_test = load_data()

epochs = 10
batch_size = 64
n_classes = len(classes)

model_params = 'n_classes':n_classes,
'learning_rate':0.0001,
'decay_rate':0.5,
'embedding_dim':128
model_dir = 'output'
face_classifier = tf.estimator.Estimator(model_fn=model_fn, params=model_params, model_dir=model_dir)


My Tensorflow version is 1.12.0



Edit
Forgot to mention I was using eager execution for this exercise, for unknown reasons that was the cause of this bug










share|improve this question






























    0















    Following the instructions on tf custom estimator



    I have created a cnn estimator and tried to train it. While training, i initialized tensorboard and was hoping to see some visualizations about training steps. However, tensorboard only showed the graph of my custom estimator but none of the scalar values i have defined.



    Here's roughly what I have in code



    def model_fn(features, labels, mode, params=None):
    tf.logging.set_verbosity(tf.logging.INFO)
    n_classes = params['n_classes']
    base_learning_rate = params['learning_rate']
    decay_rate = params['decay_rate']
    embedding_dim = params['embedding_dim']

    x = VGG_block1(features, (3, 3), 64, name='block1_1')
    x = VGG_block1(x, (3, 3), 128, name='block1_2')
    x = VGG_block1(x, (3, 3), 256, name='block1_3', regularizer=tf.contrib.layers.l1_regularizer(.1))
    x = VGG_block2(x, (3, 3), 512, name='block2_4')
    x = VGG_block2(x, (3, 3), 1024, name='block2_5')
    x = conv2d(x, 512, (5, 5), padding='valid', normalizer_fn=batch_norm, activation_fn=tf.nn.leaky_relu,
    weights_initializer=he_uniform())
    x = flatten(x)
    embedding = fully_connected(x, embedding_dim)
    logits = fully_connected(embedding, n_classes)

    # make predictions
    predictions =
    'classes': tf.argmax(logits, axis=1, name='classes'),
    'probabilities': tf.nn.softmax(logits, name='softmax'),
    'embeddings':embedding


    # if we are in prediction mode
    if mode == tf.estimator.ModeKeys.PREDICT:
    return tf.estimator.EstimatorSpec(mode=mode, predictions=predictions)

    # otherwise define losses for training
    c_loss, center = center_loss(embedding, labels, .9, n_classes)
    xent_loss = tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(labels=labels, logits=logits))
    total_loss = xent_loss + 0.5 * c_loss

    # evaluation methods
    accuracy, update_op = tf.metrics.accuracy(labels=labels, predictions=predictions['classes'], name='accuracy')
    batch_acc = tf.reduce_mean(tf.cast(tf.equal(tf.cast(labels, tf.int64), predictions['classes']), tf.float32))
    tf.summary.scalar('batch_acc', batch_acc)
    tf.summary.scalar('streaming_acc', update_op)
    tf.summary.scalar('total_loss', total_loss)
    tf.summary.scalar('center_loss', c_loss)
    tf.summary.scalar('xent_loss', xent_loss)

    # training mode
    if mode == tf.estimator.ModeKeys.TRAIN:
    update_ops = tf.get_collection(tf.GraphKeys.UPDATE_OPS)
    global_step = tf.Variable(0, trainable=False)
    global_step_op = tf.assign(global_step, global_step + 1)
    learning_rate = tf.train.exponential_decay(base_learning_rate, global_step, 8000, decay_rate, staircase=True)
    optimizer = tf.train.AdamOptimizer(learning_rate)
    with tf.control_dependencies(update_ops+[global_step_op]):
    objective = optimizer.minimize(total_loss)

    return tf.estimator.EstimatorSpec(mode=mode, loss=total_loss, train_op=objective)

    eval_metric_ops =
    'accuracy': (accuracy, update_op)

    return tf.estimator.EstimatorSpec(mode=mode, loss=total_loss, eval_metric_ops=eval_metric_ops)

    X_train, X_test, y_train, y_test = load_data()

    epochs = 10
    batch_size = 64
    n_classes = len(classes)

    model_params = 'n_classes':n_classes,
    'learning_rate':0.0001,
    'decay_rate':0.5,
    'embedding_dim':128
    model_dir = 'output'
    face_classifier = tf.estimator.Estimator(model_fn=model_fn, params=model_params, model_dir=model_dir)


    My Tensorflow version is 1.12.0



    Edit
    Forgot to mention I was using eager execution for this exercise, for unknown reasons that was the cause of this bug










    share|improve this question


























      0












      0








      0








      Following the instructions on tf custom estimator



      I have created a cnn estimator and tried to train it. While training, i initialized tensorboard and was hoping to see some visualizations about training steps. However, tensorboard only showed the graph of my custom estimator but none of the scalar values i have defined.



      Here's roughly what I have in code



      def model_fn(features, labels, mode, params=None):
      tf.logging.set_verbosity(tf.logging.INFO)
      n_classes = params['n_classes']
      base_learning_rate = params['learning_rate']
      decay_rate = params['decay_rate']
      embedding_dim = params['embedding_dim']

      x = VGG_block1(features, (3, 3), 64, name='block1_1')
      x = VGG_block1(x, (3, 3), 128, name='block1_2')
      x = VGG_block1(x, (3, 3), 256, name='block1_3', regularizer=tf.contrib.layers.l1_regularizer(.1))
      x = VGG_block2(x, (3, 3), 512, name='block2_4')
      x = VGG_block2(x, (3, 3), 1024, name='block2_5')
      x = conv2d(x, 512, (5, 5), padding='valid', normalizer_fn=batch_norm, activation_fn=tf.nn.leaky_relu,
      weights_initializer=he_uniform())
      x = flatten(x)
      embedding = fully_connected(x, embedding_dim)
      logits = fully_connected(embedding, n_classes)

      # make predictions
      predictions =
      'classes': tf.argmax(logits, axis=1, name='classes'),
      'probabilities': tf.nn.softmax(logits, name='softmax'),
      'embeddings':embedding


      # if we are in prediction mode
      if mode == tf.estimator.ModeKeys.PREDICT:
      return tf.estimator.EstimatorSpec(mode=mode, predictions=predictions)

      # otherwise define losses for training
      c_loss, center = center_loss(embedding, labels, .9, n_classes)
      xent_loss = tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(labels=labels, logits=logits))
      total_loss = xent_loss + 0.5 * c_loss

      # evaluation methods
      accuracy, update_op = tf.metrics.accuracy(labels=labels, predictions=predictions['classes'], name='accuracy')
      batch_acc = tf.reduce_mean(tf.cast(tf.equal(tf.cast(labels, tf.int64), predictions['classes']), tf.float32))
      tf.summary.scalar('batch_acc', batch_acc)
      tf.summary.scalar('streaming_acc', update_op)
      tf.summary.scalar('total_loss', total_loss)
      tf.summary.scalar('center_loss', c_loss)
      tf.summary.scalar('xent_loss', xent_loss)

      # training mode
      if mode == tf.estimator.ModeKeys.TRAIN:
      update_ops = tf.get_collection(tf.GraphKeys.UPDATE_OPS)
      global_step = tf.Variable(0, trainable=False)
      global_step_op = tf.assign(global_step, global_step + 1)
      learning_rate = tf.train.exponential_decay(base_learning_rate, global_step, 8000, decay_rate, staircase=True)
      optimizer = tf.train.AdamOptimizer(learning_rate)
      with tf.control_dependencies(update_ops+[global_step_op]):
      objective = optimizer.minimize(total_loss)

      return tf.estimator.EstimatorSpec(mode=mode, loss=total_loss, train_op=objective)

      eval_metric_ops =
      'accuracy': (accuracy, update_op)

      return tf.estimator.EstimatorSpec(mode=mode, loss=total_loss, eval_metric_ops=eval_metric_ops)

      X_train, X_test, y_train, y_test = load_data()

      epochs = 10
      batch_size = 64
      n_classes = len(classes)

      model_params = 'n_classes':n_classes,
      'learning_rate':0.0001,
      'decay_rate':0.5,
      'embedding_dim':128
      model_dir = 'output'
      face_classifier = tf.estimator.Estimator(model_fn=model_fn, params=model_params, model_dir=model_dir)


      My Tensorflow version is 1.12.0



      Edit
      Forgot to mention I was using eager execution for this exercise, for unknown reasons that was the cause of this bug










      share|improve this question
















      Following the instructions on tf custom estimator



      I have created a cnn estimator and tried to train it. While training, i initialized tensorboard and was hoping to see some visualizations about training steps. However, tensorboard only showed the graph of my custom estimator but none of the scalar values i have defined.



      Here's roughly what I have in code



      def model_fn(features, labels, mode, params=None):
      tf.logging.set_verbosity(tf.logging.INFO)
      n_classes = params['n_classes']
      base_learning_rate = params['learning_rate']
      decay_rate = params['decay_rate']
      embedding_dim = params['embedding_dim']

      x = VGG_block1(features, (3, 3), 64, name='block1_1')
      x = VGG_block1(x, (3, 3), 128, name='block1_2')
      x = VGG_block1(x, (3, 3), 256, name='block1_3', regularizer=tf.contrib.layers.l1_regularizer(.1))
      x = VGG_block2(x, (3, 3), 512, name='block2_4')
      x = VGG_block2(x, (3, 3), 1024, name='block2_5')
      x = conv2d(x, 512, (5, 5), padding='valid', normalizer_fn=batch_norm, activation_fn=tf.nn.leaky_relu,
      weights_initializer=he_uniform())
      x = flatten(x)
      embedding = fully_connected(x, embedding_dim)
      logits = fully_connected(embedding, n_classes)

      # make predictions
      predictions =
      'classes': tf.argmax(logits, axis=1, name='classes'),
      'probabilities': tf.nn.softmax(logits, name='softmax'),
      'embeddings':embedding


      # if we are in prediction mode
      if mode == tf.estimator.ModeKeys.PREDICT:
      return tf.estimator.EstimatorSpec(mode=mode, predictions=predictions)

      # otherwise define losses for training
      c_loss, center = center_loss(embedding, labels, .9, n_classes)
      xent_loss = tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(labels=labels, logits=logits))
      total_loss = xent_loss + 0.5 * c_loss

      # evaluation methods
      accuracy, update_op = tf.metrics.accuracy(labels=labels, predictions=predictions['classes'], name='accuracy')
      batch_acc = tf.reduce_mean(tf.cast(tf.equal(tf.cast(labels, tf.int64), predictions['classes']), tf.float32))
      tf.summary.scalar('batch_acc', batch_acc)
      tf.summary.scalar('streaming_acc', update_op)
      tf.summary.scalar('total_loss', total_loss)
      tf.summary.scalar('center_loss', c_loss)
      tf.summary.scalar('xent_loss', xent_loss)

      # training mode
      if mode == tf.estimator.ModeKeys.TRAIN:
      update_ops = tf.get_collection(tf.GraphKeys.UPDATE_OPS)
      global_step = tf.Variable(0, trainable=False)
      global_step_op = tf.assign(global_step, global_step + 1)
      learning_rate = tf.train.exponential_decay(base_learning_rate, global_step, 8000, decay_rate, staircase=True)
      optimizer = tf.train.AdamOptimizer(learning_rate)
      with tf.control_dependencies(update_ops+[global_step_op]):
      objective = optimizer.minimize(total_loss)

      return tf.estimator.EstimatorSpec(mode=mode, loss=total_loss, train_op=objective)

      eval_metric_ops =
      'accuracy': (accuracy, update_op)

      return tf.estimator.EstimatorSpec(mode=mode, loss=total_loss, eval_metric_ops=eval_metric_ops)

      X_train, X_test, y_train, y_test = load_data()

      epochs = 10
      batch_size = 64
      n_classes = len(classes)

      model_params = 'n_classes':n_classes,
      'learning_rate':0.0001,
      'decay_rate':0.5,
      'embedding_dim':128
      model_dir = 'output'
      face_classifier = tf.estimator.Estimator(model_fn=model_fn, params=model_params, model_dir=model_dir)


      My Tensorflow version is 1.12.0



      Edit
      Forgot to mention I was using eager execution for this exercise, for unknown reasons that was the cause of this bug







      python tensorflow tensorboard tensorflow-estimator






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 25 at 11:15







      Chester Cheng

















      asked Mar 23 at 6:04









      Chester ChengChester Cheng

      2616




      2616






















          1 Answer
          1






          active

          oldest

          votes


















          0














          as was mentioned in the edit, disabling eager execution solved the problem






          share|improve this answer























            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%2f55311095%2ftensorboard-does-not-show-any-scalar-summary-from-estimator%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            as was mentioned in the edit, disabling eager execution solved the problem






            share|improve this answer



























              0














              as was mentioned in the edit, disabling eager execution solved the problem






              share|improve this answer

























                0












                0








                0







                as was mentioned in the edit, disabling eager execution solved the problem






                share|improve this answer













                as was mentioned in the edit, disabling eager execution solved the problem







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 25 at 11:16









                Chester ChengChester Cheng

                2616




                2616





























                    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.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55311095%2ftensorboard-does-not-show-any-scalar-summary-from-estimator%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

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript