我需要帮助在 Mac 上加载 TensorBoard
Posted
技术标签:
【中文标题】我需要帮助在 Mac 上加载 TensorBoard【英文标题】:I need help loading TensorBoard on Mac 【发布时间】:2019-06-27 05:10:40 【问题描述】:这是目前与日志记录有关的部分
import tflearn
from tflearn.layers.conv import conv_2d, max_pool_2d
from tflearn.layers.core import input_data, dropout, fully_connected
from tflearn.layers.estimator import regression
import tensorflow as tf
tf.reset_default_graph()
convnet = input_data(shape =[None, WIDTH, HEIGHT, 1], name ='input')
convnet = conv_2d(convnet, 32, 5, activation ='relu')
convnet = max_pool_2d(convnet, 5)
convnet = conv_2d(convnet, 64, 5, activation ='relu')
convnet = max_pool_2d(convnet, 5)
convnet = conv_2d(convnet, 128, 5, activation ='relu')
convnet = max_pool_2d(convnet, 5)
convnet = conv_2d(convnet, 64, 5, activation ='relu')
convnet = max_pool_2d(convnet, 5)
convnet = conv_2d(convnet, 32, 5, activation ='relu')
convnet = max_pool_2d(convnet, 5)
convnet = fully_connected(convnet, 1024, activation ='relu')
convnet = dropout(convnet, 0.8)
convnet = fully_connected(convnet, PATH_TO_NUMBER_OF_CLASSES, activation ='softmax')
convnet = regression(convnet, optimizer ='adam', learning_rate = 0.001,
loss ='categorical_crossentropy', name ='targets')
model = tflearn.DNN(convnet,tensorboard_dir = 'log')
#Seperating the image and its label(One Hot Encoder)
#X is the image
#Y is the One Hot
#Therefore, i[0] is the pixel data and i[1] is the label
X = np.array([i[0] for i in train]).reshape(-1, WIDTH, HEIGHT, 1)
Y = [i[1] for i in train]
test_x = np.array([i[0] for i in test]).reshape(-1, WIDTH, HEIGHT, 1)
test_y = [i[1] for i in test]
model.fit('input': X, 'targets': Y, n_epoch=3, validation_set=. ('input': test_x, 'targets': test_y),
snapshot_step=500, show_metric=True, run_id='test')
在终端中,我确保我处于 tensorflow 环境中。然后我输入 tensorboard --logdir=/tmp/log
然后我将给定的网址复制并粘贴到浏览器中,它仍然不起作用。
【问题讨论】:
【参考方案1】:您必须设置详细级别并等于日志目录:
model = DNN(optimizer, tensorboard_verbose=3, tensorboard_dir='/tmp/tflearn_logs/')
顺便说一下/tmp/tflearn_logs/
是tensorboard_dir
的默认值,所以你不必改变这个参数。
然后您可以使用以下命令打开板:
$ tensorboard --logdir='/tmp/tflearn_logs'
来源:http://tflearn.org/getting_started/#visualization
【讨论】:
以上是关于我需要帮助在 Mac 上加载 TensorBoard的主要内容,如果未能解决你的问题,请参考以下文章
Android Emulator 在 M1 mac/Apple Silicon 上卡住了加载屏幕
Mac OS 桌面音频主机应用程序无法加载某些 AVAudioUnit 插件