【发布时间】: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
然后我将给定的网址复制并粘贴到浏览器中,它仍然不起作用。
【问题讨论】:
标签: python macos tensorflow neural-network tensorboard