【发布时间】:2016-05-10 14:39:57
【问题描述】:
我在这里可能是错的,但在这里。 我正在使用post 中的代码。
具体代码在
outputs, states = rnn.rnn(lstm_cell, _X, initial_state=_istate)
# Linear activation
# Get inner loop last output
return tf.matmul(outputs[-1], _weights['out']) + _biases['out']
上面的代码使用多对一预测方案。
我想知道我是否可以在这段代码中使用多对多方案。 并使用所有 LSTM 单元的输出来预测类别。 我试过用
替换最后一行return tf.matmul(outputs, _weights['out']) + _biases['out']
然后我得到一个错误
File "/media/anilil/Data/charm/Cnn/train_lstm_ucf.py", line 165, in <module>
pred = RNN(x, istate, weights, biases,keep_prob)
File "/media/anilil/Data/charm/Cnn/train_lstm_ucf.py", line 163, in RNN
return tf.matmul(outputs, _weights['out']) + _biases['out']
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/math_ops.py", line 938, in matmul
a = ops.convert_to_tensor(a, name="a")
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 529, in convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/constant_op.py", line 178, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/constant_op.py", line 161, in constant
tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape))
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/tensor_util.py", line 319, in make_tensor_proto
_AssertCompatible(values, dtype)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/tensor_util.py", line 256, in _AssertCompatible
raise TypeError("List of Tensors when single Tensor expected")
TypeError: List of Tensors when single Tensor expected
背景信息(非重要)
感谢您的意见。我不确定这种方法是否会产生更好的结果。
我正在尝试复制this paper 特别是本文中的activity recognition。
他们所做的是用单帧训练 CNN 来预测该帧属于哪个类,然后使用它的密集层特征来训练 LSTM,从而了解单帧之间的时间关系并提高识别率准确性。
我用 CNN 复现了结果,得到了 61% 的单帧准确率(表 1:-RGB 单帧)准确率。
我已经从这个网络中提取了 (fc-6) 特征,并将其作为 LSTM 的输入,但我没有将准确度提高到 ~71.2%,我得到的 LSTM 准确度降低了 51%。不知道为什么会这样。 (我猜他们使用的 LSTM 模型可能不同)
对此的任何想法也表示赞赏。
【问题讨论】:
标签: python machine-learning tensorflow deep-learning