我有一个包含 4 个波段的 RGBI 图像,并且希望能够使用 tensorflow 和深度学习将图像像素分为两类。在训练数据中,每个像素被视为具有 4 个值/特征的观察值作为图像强度。我使用以下函数来创建网络
def deep_learn(X,Y,X_test,Y_test):
net = input_data(shape=[None, 1,4])
net = tflearn.lstm(net, 128, return_seq=True)
net = tflearn.lstm(net, 128)
net = tflearn.fully_connected(net, 2, activation='softmax')
net = tflearn.regression(net, optimizer='adam',
loss='categorical_crossentropy', name="deep")
model = tflearn.DNN(net, tensorboard_verbose=2)
model.fit(X, Y, n_epoch=1, validation_set=0.1, show_metric=True,
snapshot_step=100)
# Save model when training is complete to a file
model.save("deep")
return model
但我收到以下错误
ValueError:无法为张量“InputData/X:0”提供形状 (64, 4) 的值,其形状为“(?, 1, 4)”
我不知道问题出在哪里。使用深度神经网络与随机森林进行基于像素的分类有什么好处吗?如果是的话,我该如何使用上述功能来做到这一点。
谢谢你。