如何在 tensorflow 中显示训练进度条? [英] How to display training progress bar in tensorflow?

查看:117
本文介绍了如何在 tensorflow 中显示训练进度条?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试向终端输出与 Keras 训练相同类型的训练进度条.我是 tensorflow 的新手,还没有尝试过 Keras,但我很想知道它是否可以在没有 Keras 的情况下完成.

I'm trying to output to the terminal the same type of training progress bar that is done with Keras training. I'm new to tensorflow and have not yet tried Keras, but I'm interested in knowing if it can be done without Keras.

推荐答案

import tensorflow as tf
train_data = (...) 
progbar = tf.keras.utils.Progbar(len(train_data))

for i, d in enumerate(train_data):
    (train model here...)
    progbar.update(i) # This will update the progress bar graph.


3714/3715 [============================>.] - ETA: 20s

  • 在 Tensorflow (v1.1~ 2.1) 中,建议使用 tf.keras.utils.Progbar() 而不是导入 tqdm.
  • 仅供参考,使用 tf.print(),而不是 python 原生打印函数.
    • In Tensorflow (v1.1~ 2.1), it is recommended to use tf.keras.utils.Progbar() instead of importing tqdm.
    • FYI, use tf.print(), instead of python native print function.
    • 这篇关于如何在 tensorflow 中显示训练进度条?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆