вот код, который я пытаюсь запустить
labelled_data = [data, Label]
X,Y = [labelled_data[0],labelled_data[1]]
X_train, X_test, Y_train, Y_test = train_test_split(X, Y, test_size=0.4,
random_state=4)
x_test, x_validation, y_test, y_validation=train_test_split(X_test,
Y_test, test_size=0.5,
random_state=4)
import numpy as np
print(X_train.shape)
вывод:
(2266, 196608)
Теперь я хочу изменить матрицы для набора обучения, набора проверки инабор тестов.
X_train = X_train.reshape((X_train.shape[0],256,256,1))
x_validation = x_validation.reshape((x_validation.shape[0],256,256,1))
x_test =x_test.reshape((x_test.shape[0],256,256,1))
X_train = X_train.astype('float32')
x_validation = x_validation.astype('float32')
x_test = x_test.astype('float32')
X_train = X_train/255
x_validation = x_validation/255
x_test =x_test/255
from keras.utils import np_utils
Y_train = np_utils.to_categorical(Y_train,8)
y_validation =np_utils.to_categorical(y_validation,8)
y_test =np_utils.to_categorical(y_test,8)
во время работы я получаю сообщение об ошибке.
ValueError Traceback (most recent call last)
<ipython-input-30-fc799feec008> in <module>
----> 1 X_train = X_train.reshape((X_train.shape[0],256,256,1))
2 x_validation = x_validation.reshape((x_validation.shape[0],256,256,1))
3 x_test =x_test.reshape((x_test.shape[0],256,256,1))
4
5 X_train = X_train.astype('float32')
ValueError: cannot reshape array of size 445513728 into shape (2266,256,256,1)
, пожалуйста, помогите мне с этим