tensorboad使用血泪史
本来是按照师姐的吩咐,在做压缩神经的实验,改改师姐的代码,看起来都很容易,突然抽了个疯,想把这个网络的图画出来,结果,死在tensorboard上了:
前提
- 安装好anaconda 和 python 和tensorflow。下面这个博客,一站搞定:windows+anaconda+python
- 安装tensorboard
找一段代码然后执行
我用的是自己的代码改了改。尝试使用tensorboard的可以使用下面这个代码,传说是官网给的,有点长啊啊。这有个教程解释得还比较详细:tensorboard,辛苦他了。
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import sys
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
FLAGS = None
def train():
# Import data
mnist = input_data.read_data_sets(FLAGS.data_dir,
one_hot=True,
fake_data=FLAGS.fake_data)
sess = tf.InteractiveSession()
# Create a multilayer model.
# Input placeholders
with tf.name_scope('input'):
x = tf.placeholder(tf.float32, [None, 784], name='x-input')
y_ = tf.placeholder(tf.float32, [None, 10], name='y-input')
with tf.name_scope('input_reshape'):
image_shaped_input = tf.reshape(x, [-1, 28, 28, 1])
tf.summary.image('input', image_shaped_input, 10)
# We can't initialize these variables to 0 - the network will get stuck.
def weight_variable(shape):
"""Create a weight variable with appropriate initialization."""
initial = tf.truncated_normal(shape, stddev=0.1)
return tf.Variabl

本文记录了在Win10环境下使用Tensorboard进行神经网络可视化时遇到的问题及解决过程。首先确保安装了Anaconda、Python和Tensorflow。在尝试使用Tensorboard时,通过代码生成日志文件,关键在于设置正确的log_dir。运行代码后,需在Anaconda的终端中切换到日志文件夹并启动Tensorboard。如果出现无法显示数据的情况,可能是因为父路径不是文件夹导致,应确保父路径为一个具体的文件夹。此外,学习了如何在指定路径打开CMD的方法。
&spm=1001.2101.3001.5002&articleId=79041950&d=1&t=3&u=04c1fc6af62d43ca80001776b0b06b35)
3万+

被折叠的 条评论
为什么被折叠?



