要学习更多关于深度学习和计算机视觉的知识,我正在开发一个项目来执行道路上的车道检测。我使用TFLearn作为Tensorflow的包装。塑造Tensorflow/TFLearn输入/输出图像的问题
背景
训练输入是道路的图像(表示为50×50像素2D阵列的每个图像,其中每个元素的亮度值从0.0到1.0)。
训练输出形状相同(50x50阵列),但表示标记的车道面积。本质上,非道路像素为0,道路像素为1.
这不是一个固定大小的图像分类问题,而是一个从图片中检测道路与非道路像素的问题。
问题
我没有能够成功塑造我的输入/输出的方式,TFLearn/Tensorflow接受,我不知道为什么。这是我的示例代码:
# X = An array of training inputs (of shape (50 x 50)).
# Y = An array of training outputs (of shape (50 x 50)).
# "None" equals the number of samples in my training set, 50 represents
# the size of the 2D image array, and 1 represents the single channel
# (grayscale) of the image.
network = input_data(shape=[None, 50, 50, 1])
network = conv_2d(network, 50, 50, activation='relu')
# Does the 50 argument represent the output shape? Should this be 2500?
network = fully_connected(network, 50, activation='softmax')
network = regression(network, optimizer='adam', loss='categorical_crossentropy', learning_rate=0.001)
model = tflearn.DNN(network, tensorboard_verbose=1)
model.fit(X, Y, n_epoch=10, shuffle=True, validation_set=(X, Y), show_metric=True, batch_size=1)
我收到的错误是在model.fit
呼叫,与错误:
ValueError: Cannot feed value of shape (1, 50, 50) for Tensor u'InputData/X:0', which has shape '(?, 50, 50, 1)'
我试图减少样品输入/输出阵列以一维向量(长度为2500),但会导致其他错误。
我有点失落,如何塑造这一切,任何帮助将不胜感激!
听起来像人事问题 – boztalay