I have a problem with the program I created to classify images. I store my image in an array
arr = np.concatenate((X1, Y1))
where has size : (80, 128, 128, 3) and i have another one :
arr2 = np.concatenate((X2, Y2))
where has size : (20, 128, 128, 3) I will make array into training data. and create target :
a= np.full((1, 40), 1)
b= np.full((1, 40), 2)
arr3 = np.concatenate((a, b))
and set into knn algorithm
knn=KNeighborsClassifier(n_neighbors=3) #define K=3
knn.fit(arr,arr3)
res = knn.predict(arr2)
print(res)
I don't get results and there is an error: Found array with dim 4. Estimator expected <= 2.
I've also tried to reshape arr and arr2 :
arr5 = arr.reshape(-1,1)
arr6 = arr2.reshape(-1,1)
but also getting errors: Found input variables with inconsistent numbers of samples
I need your opinion about this to fix the problem.