我用的是关于卷积神经网络的教程。在此函数中,我使用:
# Train the model
train_input_fn = tf.estimator.inputs.numpy_input_fn(
x={"x": X_train},
y=y_train,
batch_size=100,
num_epochs=None,
shuffle=True)
mnist_classifier.train(
input_fn=train_input_fn,
steps=20000,
hooks=[logging_hook])
在哪里
^{pr2}$列表
type(y_train)
列表
y_train[0]
“0”
X_train[0].shape
(30,29,3)
type(X_train[0])
在努比·恩达雷在
len(X_train)
39209个
len(y_train)
39209个
我得到以下错误: AttributeError:“list”对象没有属性“shape”
X_train
看起来像一个numpy数组的列表,tensorflow需要一个numpy数组,您可以通过以下方法将其转换为numpy数组:或者使用numpy.asarray函数,它的作用与上面完全相同:
^{pr2}$请记住,所有的图像都应该具有相同的尺寸,以便转换为工作。在
相关问题 更多 >
编程相关推荐