Tensorboard 在 Chrome 中显示空白页

Tensorboard shows blank page in Chrome

我是 TensorFlow 和 Tensorboard 的新手,当我 运行 下面的代码时,模型训练并且 returns 它的输出很好,但是 Tensorboard 在浏览器中显示一个空白页面。

import pandas as pd
import os
import tensorflow as tf
from time import time
from tensorflow.python.keras.layers.core import Dense
from tensorflow.python.keras.models import Sequential
from tensorflow.python.keras.layers import LSTM
from tensorflow.python.keras.callbacks import TensorBoard
import matplotlib.pyplot as plt
from sklearn.preprocessing import MinMaxScaler
import numpy as np

model = Sequential()
model.add(LSTM(units=20, return_sequences=True, input_shape=(1, 7), activation='softsign'))
model.add(LSTM(units=50, return_sequences=True, activation='softsign'))
model.add(LSTM(units=50, return_sequences=True, activation='softsign'))
model.add(LSTM(units=50, return_sequences=True, activation='softsign'))
model.add(LSTM(units=20, activation='softsign'))
model.add(Dense(units=1, activation='sigmoid'))

model.compile(loss='mse', optimizer='Nadam',metrics=['mse'])

tensorboard = TensorBoard(log_dir="logs/fit")

result = model.fit(X_train, Y_train, batch_size=200, epochs=5, validation_split=0.1, verbose=1, callbacks=[tensorboard])

我在 PyCharm 终端中使用 tensorboard --logdir=logs/ 实例化 TensorBoard,并在 Chrome (http://localhost:6006/ ) 中打开 Tensorboard。但是页面是空白的,没有显示任何输出(甚至没有 Tensorboard 的橙色 header)。

非常感谢任何帮助!

谢谢。

为了社区的利益,我在这里发布答案

import pandas as pd
import os
import tensorflow as tf
from time import time
from tensorflow.python.keras.layers.core import Dense
from tensorflow.python.keras.models import Sequential
from tensorflow.python.keras.layers import LSTM
from tensorflow.python.keras.callbacks import TensorBoard
import matplotlib.pyplot as plt
from sklearn.preprocessing import MinMaxScaler
import numpy as np

model = Sequential()
model.add(LSTM(units=20, return_sequences=True, input_shape=(1, 7), activation='softsign'))
model.add(LSTM(units=50, return_sequences=True, activation='softsign'))
model.add(LSTM(units=50, return_sequences=True, activation='softsign'))
model.add(LSTM(units=50, return_sequences=True, activation='softsign'))
model.add(LSTM(units=20, activation='softsign'))
model.add(Dense(units=1, activation='sigmoid'))

model.compile(loss='mse', optimizer='Nadam',metrics=['mse'])

tensorboard = TensorBoard(log_dir="logs/fit")

result = model.fit(X_train, Y_train, batch_size=200, epochs=5, validation_split=0.1, verbose=1, callbacks=[tensorboard])

%load_ext tensorboard
%tensorboard --logdir logs