我正在努力实现已经过训练的TensorFlow基本LSTM和可以在浏览器中运行的javascript版本之间的接口.问题在于,在我读过的所有文献中,LSTM被建模为迷你网络(仅使用连接,节点和门),而TensorFlow似乎还有很多其他问题.
我有两个问题:
TensorFlow模型能否轻松转换为更传统的神经网络结构?
是否有一种实用的方法来映射TensorFlow为您提供的可训练变量?
我可以从TensorFlow中获取"可训练的变量",问题是它们似乎只有一个LSTM节点的偏差值,我看到的大多数模型都会包含几个存储单元的偏差,输入和输出.
我有来自四个不同国家的40k图像数据集.图像包含各种主题:室外场景,城市场景,菜单等.我想使用深度学习来对图像进行地理标记.
我开始使用一个由3个conv-> relu-> pool层组成的小型网络,然后又添加了3个以加深网络,因为学习任务并不简单.
实际上,这种损失开始变得平滑并且几百步下降,但随后开始逐渐上升.
对于我这样增加的损失有什么可能的解释?
我的初始学习率设定得很低:1e-6,但我也试过1e-3 | 4 | 5.我对网络设计进行了理智检查,检查了两个具有类别不同主题的类的小型数据集,并且损失会根据需要不断下降.列车精度徘徊在~40%
convolution deep-learning tensorflow tensorboard cross-entropy
有没有办法在tensorflow上显示多个不同运行的平均值?我只能在同一个图表上看到它们(通过发送不同运行的路径),但我想在图表上看到它们的平均值
我试图得到下面神经网络的训练过程的总结.
import tensorflow as tf
import numpy as np
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets(".\MNIST",one_hot=True)
# Create the model
def train_and_test(hidden1,hidden2, learning_rate, epochs, batch_size):
with tf.name_scope("first_layer"):
input_data = tf.placeholder(tf.float32, [batch_size, 784], name = "input")
weights1 = tf.Variable(
tf.random_normal(shape =[784, hidden1],stddev=0.1),name = "weights")
bias = tf.Variable(tf.constant(0.0,shape =[hidden1]), name = "bias")
activation = tf.nn.relu(
tf.matmul(input_data, weights1) + bias, name = "relu_act")
tf.summary.histogram("first_activation", activation)
with tf.name_scope("second_layer"):
weights2 = tf.Variable(
tf.random_normal(shape =[hidden1, hidden2],stddev=0.1),
name = "weights")
bias2 = tf.Variable(tf.constant(0.0,shape =[hidden2]), name = "bias") …Run Code Online (Sandbox Code Playgroud) 我试图用Tensorboard可视化我的Keras模型的重量.这是我正在使用的模型:
model = Sequential([
Conv2D(filters=32, kernel_size=(3,3), padding="same", activation='relu', input_shape=(40,40,3)),
MaxPooling2D(pool_size=(2, 2)),
Conv2D(filters=64, kernel_size=(5,5), padding="same", activation='relu'),
MaxPooling2D(pool_size=(2, 2)),
Flatten(),
Dense(1024, activation='relu'),
Dropout(0.5),
Dense(43, activation='softmax'),
])
model.compile(optimizer='sgd',
loss='categorical_crossentropy',
metrics=['accuracy'])
Run Code Online (Sandbox Code Playgroud)
我正在接受这个电话的培训:
model.fit_generator(
...
callbacks = [
ModelCheckpoint('models/gtsrb1-{epoch}.hdf5', verbose=1, save_best_only = True),
TensorBoard(log_dir='tblogs/', write_graph=True, write_grads=True, write_images=True),
EarlyStopping(patience=5, verbose=1),
],)
Run Code Online (Sandbox Code Playgroud)
但是,当我启动TensorBoard时,这就是我得到的:
Scalars和Graphs看起来还不错,所以这不是错误的问题logdir.我在这做错了什么?
我正在使用几个LSTM层来形成深度递归神经网络.我想在训练期间监控每个LSTM层的权重.但是,我无法找到如何将LSTM图层权重的摘要附加到TensorBoard.
有什么建议可以做到这一点?
代码如下:
cells = []
with tf.name_scope("cell_1"):
cell1 = tf.contrib.rnn.LSTMCell(self.embd_size, state_is_tuple=True, initializer=self.initializer)
cell1 = tf.contrib.rnn.DropoutWrapper(cell1,
input_keep_prob=self.input_dropout,
output_keep_prob=self.output_dropout,
state_keep_prob=self.recurrent_dropout)
cells.append(cell1)
with tf.name_scope("cell_2"):
cell2 = tf.contrib.rnn.LSTMCell(self.n_hidden, state_is_tuple=True, initializer=self.initializer)
cell2 = tf.contrib.rnn.DropoutWrapper(cell2,
output_keep_prob=self.output_dropout,
state_keep_prob=self.recurrent_dropout)
cells.append(cell2)
with tf.name_scope("cell_3"):
cell3 = tf.contrib.rnn.LSTMCell(self.embd_size, state_is_tuple=True, initializer=self.initializer)
# cell has no input dropout since previous cell already has output dropout
cell3 = tf.contrib.rnn.DropoutWrapper(cell3,
output_keep_prob=self.output_dropout,
state_keep_prob=self.recurrent_dropout)
cells.append(cell3)
cell = tf.contrib.rnn.MultiRNNCell(
cells, state_is_tuple=True)
output, self.final_state = tf.nn.dynamic_rnn(
cell,
inputs=self.inputs,
initial_state=self.init_state)
Run Code Online (Sandbox Code Playgroud) 我知道如何在使用张量板训练后可视化张量流图.现在,是否可以只显示图形的前向部分,即没有定义训练操作符?
我问这个的原因是我收到了这个错误:
No gradients provided for any variable, check your graph for ops that do not support gradients, between variables [ ... list of model variables here ... ] and loss Tensor("Mean:0", dtype=float32).
Run Code Online (Sandbox Code Playgroud)
我想检查图表以找出梯度张量流(双关语意图)被打破的位置.
python visualization machine-learning tensorflow tensorboard
我的tensorflow安装在ubuntu 16.04上并且还生成日志文件,但是当运行tensorboard时,Google Chrome上没有任何内容.命令行没有错误.
此错误仅出现在Google Chrome上.我该怎么做才能正确显示它?
不推荐使用此文件.请使用
iron-flex-layout/iron-flex-layout-classes.html,并使用 其中一个特定的dom-modulesthinkpad /:39507不推荐使用此文件.请使用
iron-flex-layout/iron-flex-layout-classes.html,并使用 其中一个特定的dom-modulesthinkpad /:157058未捕获TypeError:Object.values不是函数
我是第一次在Tensorflow中实现线性回归.最初,我尝试使用线性模型,但经过几次训练后,我的参数突然变为无穷大.所以,我将我的模型改为二次模型并再次尝试训练,但仍然在几次迭代的时期之后,同样的事情正在发生.
因此,tf.summary.histogram('Weights',W0)中的参数接收inf作为参数,类似于W1和b1的情况.
我想在tensorboard中看到我的参数(因为我从来没有使用它)但是得到了这个错误.
我之前已经问过这个问题,但是稍微改变的是我使用的线性模型又给出了同样的问题(我不知道这是因为参数变为无穷大因为我在Ipython笔记本中运行了这个但是当我在终端中运行程序时,生成了下面提到的错误,这帮助我弄清楚问题是由于参数射到无穷大).在评论部分,我知道它在某人的PC上工作,他的张量板显示参数实际上达到了无穷大.
这是前面提到的问题的链接.我希望我在我的程序中正确地宣布Y_其他人纠正我!
以下是Tensorflow中的代码:
import tensorflow as tf
import numpy as np
import pandas as pd
from sklearn.datasets import load_boston
import matplotlib.pyplot as plt
boston=load_boston()
type(boston)
boston.feature_names
bd=pd.DataFrame(data=boston.data,columns=boston.feature_names)
bd['Price']=pd.DataFrame(data=boston.target)
np.random.shuffle(bd.values)
W0=tf.Variable(0.3)
W1=tf.Variable(0.2)
b=tf.Variable(0.1)
#print(bd.shape[1])
tf.summary.histogram('Weights', W0)
tf.summary.histogram('Weights', W1)
tf.summary.histogram('Biases', b)
dataset_input=bd.iloc[:, 0 : bd.shape[1]-1];
#dataset_input.head(2)
dataset_output=bd.iloc[:, bd.shape[1]-1]
dataset_output=dataset_output.values
dataset_output=dataset_output.reshape((bd.shape[0],1))
#converted (506,) to (506,1) because in pandas
#the shape was not changing and it was needed later in feed_dict
dataset_input=dataset_input.values #only dataset_input is in DataFrame form and converting …Run Code Online (Sandbox Code Playgroud) 我运行了一个强化学习训练脚本,该脚本使用 Pytorch 并将数据记录到 tensorboardX 并保存检查点。现在我想继续训练。我如何告诉tensorboardX从我离开的地方继续?谢谢你!
tensorboard ×10
tensorflow ×7
convolution ×1
keras ×1
lstm ×1
python ×1
python-3.x ×1
pytorch ×1
tensorboardx ×1