我在Windows上使用带有tensoflow后端的keras,我想用tensorboard进行可视化。我遇到的问题是在文件夹中我看到keras创建的文件,但是当你想在tensorboard中查看它们时,它找不到它们
callbacks = keras.callbacks.TensorBoard(log_dir='C:\\Users\\pc1\\Desktop\\logs\\', histogram_freq=1, write_graph=True, write_images=True, embeddings_freq=1)
with tf.device('/cpu:0'):
model = Sequential()
model.add(Dense(100, input_dim=50, activation='relu'))
model.add(Dense(1, activation='sigmoid'))
model.compile(loss='binary_crossentropy', optimizer='rmsprop', metrics=['accuracy'])
model.fit(X_train, y_train, callbacks = [callbacks])
检查目录:C:\Users\pc1\Desktop\logs>dir
10/06/2017 13:43 1.351.108 events.out.tfevents.1497094943.DESKTOP-05415FP
10/06/2017 13:54 1.481.044 events.out.tfevents.1497095663.DESKTOP-05415FP
C:\>tensorboard --inspect --logdir='C:\Users\pc1\Desktop\logs\'
在logdir' C:\ Users \ pc1 \ Desktop \ logs \'
中找不到任何事件文件答案 0 :(得分:0)
尝试从Tensorboard检查中删除最后一个斜杠/反斜杠:tensorboard --inspect --logdir='C:\Users\pc1\Desktop\logs'
。
通常,您的事件文件需要位于指向Tensorboard的logdir内部的文件夹中。
我通常使用此代码段:
now = datetime.now()
logdir = "_tf_logs/" + now.strftime("%Y%m%d-%H%M%S") + "/"
tb = TensorBoard(log_dir=logdir)
callbacks=[tb]
…
model.fit(x_train, y_train, batch_size = 16, epochs = 4,
verbose = 0, callbacks = callbacks)
在其中包含_tf_logs的目录中,我使用:
启动Tensorboardtensorboard --logdir=_tf_logs