Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problematic image array #3

Open
korenbrand opened this issue Jun 3, 2018 · 0 comments
Open

Problematic image array #3

korenbrand opened this issue Jun 3, 2018 · 0 comments

Comments

@korenbrand
Copy link

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant