我正在训练tflearn模型,但是当我尝试拟合模型时会出现此错误
ValueError:无法为Tensor输入形状(64,4)的值 'targets / Y:0',其形状为'(?,3)'
我尝试使用以下代码重塑test_y变量:
test_y = np.reshape(test_y, (-1, 3))
但随后出现此错误:
ValueError:无法将大小为400的数组重塑为形状(3)
这是我的代码
for i in range(EPOCHS):
for i in range(1,hm_data+1):
train_data = np.load('training_data.npy')
train = train_data[:-100]
test = train_data[-100:]
X = np.array([i[0] for i in train]).reshape(-1,WIDTH,HEIGHT,1)
Y = [i[1] for i in train]
Y = np.reshape(Y, (-1, 3))
print("Shape: ", X.shape)
print(np.shape(Y))
test_x = np.array([i[0] for i in test]).reshape(-1,WIDTH,HEIGHT,1)
test_y = [i[1] for i in test]
model.fit({'input': X}, {'targets': Y}, n_epoch=1, validation_set=({'input': test_x}, {'targets': test_y}),
snapshot_step=500, show_metric=True, run_id=MODEL_NAME)
model.save(MODEL_NAME)