【发布时间】:2020-01-26 21:02:24
【问题描述】:
我试图重新创建 Sentdex 在“python 玩 gta V”系列中所做的程序,但是当我来训练 AI 时,它让我出现了这个错误:ValueError: Cannot feed value of shape (64, 80, 60, 3) for Tensor 'input/X:0', which has shape '(?, 80, 60, 1)' 我试图计算 sme 参数,但它没有不工作。这是我的代码:
import numpy as np
from alexnet import alexnet
import time
width=80
height=60
lr=1e-3
epochs=30
model_name='minecraft-ai-{}-{}-{}'.format(lr,'ghostbot',epochs)
model=alexnet(width,height,lr)
train_data=np.load('training_data.npy',allow_pickle=True)
train=train_data[:-500]
test=train_data[-500:]
X=np.array([i[0]for i in train]).reshape(-1,width,height,3)
Y=[i[1] for i in train]
test_x = np.array([i[0] for i in test]).reshape(-1,width,height,3)
test_y = [i[1] for i in test]
print(X.shape)
print(test_x.shape)
time.sleep(3)
model.fit({'input': X}, {'targets': Y}, n_epoch=epochs, validation_set=({'input': test_x}, {'targets': test_y}),
snapshot_step=500, show_metric=True, run_id=model_name,)
model.save(model_name)
【问题讨论】:
标签: python-3.x tensorflow deep-learning