这是目前唯一将有什么做记录的部分。
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 /日志
后来我复制并粘贴到浏览器中给定的URL,它仍然无法正常工作。
答案 0 :(得分:1)
您必须设置详细级别并等于日志目录:
model = DNN(optimizer, tensorboard_verbose=3, tensorboard_dir='/tmp/tflearn_logs/')
顺便说一下,/tmp/tflearn_logs/
是tensorboard_dir
的默认值,因此您不必更改此参数。
然后您可以使用以下方法打开板子:
$ tensorboard --logdir='/tmp/tflearn_logs'