# Reshape and normalize training data
trainX = train[:, 1:].reshape(train.shape[0],1,28, 28).astype( 'float32' )
x_train = trainX / 255.0
y_train = train[:,98]
# Reshape and normalize test data
testX = test[:,1:].reshape(test.shape[0],1, 28, 28).astype( 'float32' )
x_test = testX / 255.0
y_test = test[:,98]
我尝试将我的 csv train_data 和 test_data 重塑为 3-D 矩阵,但出现错误:
ValueError Traceback (most recent call last)
<ipython-input-57-268af51a6b14> in <module>()
----> 1 trainX = train[:, 1:].reshape(train.shape[0],1,28, 28).astype( 'float32' )
2 x_train = trainX / 255.0
3
4 y_train = train[:,98]
5
ValueError: cannot reshape array of size 23760 into shape (240,1,28,28)
LEATH
相关分类