Handwriting recognition with SVM, changing training and testing values

asked 2016-02-27 23:26:44 -0600

sope gravatar image

updated 2016-02-28 02:53:47 -0600

http://opencv-python-tutroals.readthe...

In this example OpenCV gives, the training set is of 250 and testing amount is also the same. However when the testing and training numbers are changed, the accuracy goes down to 0.

# First half is trainData, remaining is testData
train_cells = [ i[:40] for i in cells ] 
test_cells = [ i[40:] for i in cells]

x = 200
responses = np.float32(np.repeat(np.arange(10),x)[:,np.newaxis])

I have changed the values in above lines of code. What am I doing wrong? And what should x be?

edit retag flag offensive close merge delete

Comments

there's a lot of context missing here. how do you get to x = 40*50 ? you seem to have only 40 images in your trainset. how does your train data look exactly ?

berak gravatar imageberak ( 2016-02-27 23:57:03 -0600 )edit

sorry, the x value should be 200. In the original code in the above link, the training set is 250 and testing set is 250. I'm trying to change those values to 200 and 300. The image is the digits.png provided with opencv: http://wormassay.googlecode.com/svn/t...

sope gravatar imagesope ( 2016-02-28 02:58:12 -0600 )edit

Figured it out. Created a separate array for comparing the results at the end of the code.

sope gravatar imagesope ( 2016-02-28 06:00:32 -0600 )edit

can you explain a bit more ? (so we can make it an answer?)

berak gravatar imageberak ( 2016-02-28 06:04:30 -0600 )edit