Я пытался сделать классификатор изображений, используя python и Keras, но я столкнулся с следующей ошибкой:
ValueError: Error when checking model input: the list of Numpy arrays that
you are passing to your model is not the size the model expected. Expected
to see 1 array(s), but instead got the following list of 1816 arrays:
Я попытался изменить x_train в массив numpy, но все равно получил ошибку:
ValueError: Error when checking input: expected conv2d_13_input to have 4
dimensions, but got array with shape (1816, 1)
это часть моего кода:
def read_and_process_image(imagesTrain):
x_train = []
y_train = []
for trImage in imagesTrain:
x_train.append(cv2.imread(trImage, cv2.IMREAD_COLOR))
if 'A' in trImage:
y_train.append(0)
elif 'B' in trImage:
y_train.append(1)
return x_train, y_train
x_train, y_train = read_and_process_image(train_imgs)
modelo.fit(x_train,y_train,batch_size=50,epochs=7,verbose=1)
Я не показывал весь код, чтобы он не заполнял все окно, но кто-то знает, как решить эту проблему?