CCrush-Bot icon indicating copy to clipboard operation
CCrush-Bot copied to clipboard

Problematic image array

Open korenbrand opened this issue 7 years ago • 0 comments

I've got the following errors when running the code:

File “main.py”, line 165, in
main()
File “main.py”, line 152, in main
board_img = grab_board()
File “main.py”, line 97, in grab_board
game_board[y][x] = recognizer.predict(cell)
File “D:\python27\CCrush-Bot-master\sklearn_decoder.py”, line 80, in predict
return int(self.svc.predict(np_img))
File “D:\python27\lib\site-packages\sklearn\svm\base.py”, line 548, in predict

y = super(BaseSVC, self).predict(X)
File “D:\python27\lib\site-packages\sklearn\svm\base.py”, line 308, in predict

X = self._validate_for_predict(X)
File “D:\python27\lib\site-packages\sklearn\svm\base.py”, line 439, in _valida
te_for_predict
X = check_array(X, accept_sparse=’csr’, dtype=np.float64, order=”C”)
File “D:\python27\lib\site-packages\sklearn\utils\validation.py”, line 441, in
check_array
“if it contains a single sample.”.format(array))
ValueError: Expected 2D array, got 1D array instead:
array=[ 52. 76. 96. … 105. 114. 126.].
Reshape your data either using array.reshape(-1, 1) if your data has a single fe
ature or array.reshape(1, -1) if it contains a single sample.

korenbrand avatar Jun 03 '18 11:06 korenbrand