Hard Model.fit详细格式

问题描述 投票:2回答:1

我在Jupyter笔记本中运行Keras model.fit(),如果verbose设置为1,则输出非常混乱:

    Train on 6400 samples, validate on 800 samples
    Epoch 1/200
    2080/6400 [========>.....................] - ETA: 39s - loss: 0.4383 - acc: 0.79 
    - ETA: 34s - loss: 0.3585 - acc: 0.84 - ETA: 33s - loss: 0.3712 - acc: 0.84 
    - ETA: 34s - loss: 0.3716 - acc: 0.84 - ETA: 33s - loss: 0.3675 - acc: 0.84 
    - ETA: 33s - loss: 0.3650 - acc: 0.84 - ETA: 34s - loss: 0.3759 - acc: 0.83 
    - ETA: 34s - loss: 0.3933 - acc: 0.82 - ETA: 34s - loss: 0.3985 - acc: 0.82 
    - ETA: 34s - loss: 0.4057 - acc: 0.82 - ETA: 33s - loss: 0.4071 - acc: 0.81 
    ....

正如您所看到的,ETA,loss,acc输出会保留在日志中,而不是替换第一行中的原始ETA / loss / acc值,就像进度条的工作方式一样。

如何解决它,以便每个时期只显示1行进度条,ETA,损失和acc?现在,随着训练的继续,我的细胞输出有很多这些细胞系。

我在Windows 10上运行Python 3.6.1,具有以下模块版本:

jupyter                            1.0.0
jupyter-client                     5.0.1
jupyter-console                    5.1.0
jupyter-core                       4.3.0
jupyterthemes                      0.19.0
Keras                              2.2.0
Keras-Applications                 1.0.2
Keras-Preprocessing                1.0.1
tensorflow-gpu                     1.7.0

谢谢。

python python-3.x keras jupyter-notebook jupyter
1个回答
5
投票

您可以尝试使用Keras改编版的TQDM进度条库。

使用说明可以归结为:

  1. 例如安装每pip install keras-tqdm(稳定)或pip install git+https://github.com/bstriner/keras-tqdm.git(最新开发版)
  2. 使用from keras_tqdm import TQDMNotebookCallback导入回调函数
  3. fit设置运行Keras'fit_generatorverbose=0,但是对进口的TQDMNotebookCallback进行回调,例如: model.fit(X_train, Y_train, verbose=0, callbacks=[TQDMNotebookCallback])

结果:

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.