import tensorflow as tf
import numpy as np
from test5 import gen_captcha, numbers
def text2vec(text):
vector = np.zeros(40)
for i in range(len(text)):
idx = i*10+ord(text[i])-48
vector[idx] = 1
return vector
def get_batch (size = 100):
batch_x = np.zeros([size, 9600])
batch_y = np.zeros([size, 40])
for i in range(size):
text,image = gen_captcha()
batch_x[i,:] = np.mean(image, -1).flatten()/255
batch_y[i,:] = text2vec(text)
return batch_x, batch_y
with tf.Session() as sess:
text,image=gen_captcha()
image0=tf.reshape(image,shape=[-1,60,160,3])
tf.summary.image('image0',image0)
writer=tf.summary.FileWriter('a')
merged=tf.summary.merge_all()
summary=sess.run(merged)
writer.add_summary(summary)
我上午运行的时候是有的,也能用Tensorboard打开,但是当我下午再次运行同样的代码时,却没有显示tensorboard的日志文件。