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

issue with kNearest #21

Open
abhinav29a opened this issue Jan 12, 2020 · 3 comments
Open

issue with kNearest #21

abhinav29a opened this issue Jan 12, 2020 · 3 comments

Comments

@abhinav29a
Copy link

abhinav29a commented Jan 12, 2020

The following is the error showing

/usr/local/lib/python2.7/dist-packages/ipykernel_launcher.py:42: UserWarning: loadtxt: Empty input file: "classifications.txt"
/usr/local/lib/python2.7/dist-packages/ipykernel_launcher.py:50: UserWarning: loadtxt: Empty input file: "flattened_images.txt"

errorTraceback (most recent call last)
<ipython-input-3-d66bbb23e230> in <module>()
    140 ###################################################################################################
    141 if __name__ == "__main__":
--> 142     main()
    143 # end if

<ipython-input-3-d66bbb23e230> in main()
    122         npaROIResized = np.float32(npaROIResized)       # convert from 1d numpy array of ints to 1d numpy array of floats
    123 
--> 124         retval, npaResults, neigh_resp, dists = kNearest.findNearest(npaROIResized, k = 1)     # call KNN function find_nearest
    125 
    126         strCurrentChar = str(chr(int(npaResults[0][0])))                                             # get character from results

error: OpenCV(3.4.3) /io/opencv/modules/ml/src/knearest.cpp:312: error: (-215:Assertion failed) test_samples.type() == CV_32F && test_samples.cols == samples.cols in function 'findNearest'

I dont know what to do can anybody suggest something

@joaolcaas
Copy link

I'm facing the same problem here

@abhinav29a
Copy link
Author

I am running my code on google colab and this is the error shown
Any idea where the issue is ?

@joaolcaas
Copy link

I was runnning just the main file at my computer and this error was showing up after some chages that i had done. I was looking for some help in issue page and i found this. Just make this changes after download the repository and the code will work properly.

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

2 participants