someshkhandelia / Final-Year-Project

9 stars 3 forks source link

Query data dimension does not match training data. #2

Open Adarsh8960 opened 6 years ago

Adarsh8960 commented 6 years ago

Traceback (most recent call last): File "C:\Users\Adarsh\Desktop\FYP\Final-Year-Project-master\AttendanceTaker.py", line 52, in predictions = ifk_obj.getPrediction('KNN_Classifier_80_TrainingData_92_percent_accurate') File "C:\Users\Adarsh\Desktop\FYP\Final-Year-Project-master\ImageFeederKNN.py", line 49, in getPrediction self.predicted_results = self.KNN_classifier.predict(self.array_of_images) File "C:\Program Files\Python35\lib\site-packages\sklearn\neighbors\classification.py", line 145, in predict neigh_dist, neigh_ind = self.kneighbors(X) File "C:\Program Files\Python35\lib\site-packages\sklearn\neighbors\base.py", line 385, in kneighbors for s in gen_even_slices(X.shape[0], n_jobs) File "C:\Program Files\Python35\lib\site-packages\sklearn\externals\joblib\parallel.py", line 779, in call while self.dispatch_one_batch(iterator): File "C:\Program Files\Python35\lib\site-packages\sklearn\externals\joblib\parallel.py", line 625, in dispatch_one_batch self._dispatch(tasks) File "C:\Program Files\Python35\lib\site-packages\sklearn\externals\joblib\parallel.py", line 588, in _dispatch job = self._backend.apply_async(batch, callback=cb) File "C:\Program Files\Python35\lib\site-packages\sklearn\externals\joblib_parallel_backends.py", line 111, in apply_async result = ImmediateResult(func) File "C:\Program Files\Python35\lib\site-packages\sklearn\externals\joblib_parallel_backends.py", line 332, in init self.results = batch() File "C:\Program Files\Python35\lib\site-packages\sklearn\externals\joblib\parallel.py", line 131, in call return [func(*args, *kwargs) for func, args, kwargs in self.items] File "C:\Program Files\Python35\lib\site-packages\sklearn\externals\joblib\parallel.py", line 131, in return [func(args, **kwargs) for func, args, kwargs in self.items] File "sklearn\neighbors\binary_tree.pxi", line 1294, in sklearn.neighbors.kd_tree.BinaryTree.query ValueError: query data dimension must match training data dimension

someshkhandelia commented 6 years ago

In AttendanceTaker.py Add this in line 30:

img = cv2.imread("captured_image.jpg",0)