Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

NormalBayesClassifier (with BOW) predictions differs if saving and loading the files

I have trained a classifier (NormalBayesClassifier using BOW) on a database, in fact a part of the database, and then test it over the same data: on the trained descriptors (error of prediction is 0%) and on the descriptors of the remained part of the datas (error of prediction is 13%). I save the trained classifier and the BOW vocabulary in .xml format. Then I do another test: I load the classifier and the vocabulary and test the classifier (predict) on the descriptors of whole database's descriptors (using the same detector as for training and the same extractor and the same matcher types for BOWImgDescriptorExtractor); what is strange is that the prediction error grows (20%).

I have thought that it may be because I have tested on not the whole data, so I have done a test on the wole data after training (and before saving the files), but I have found a smaller error (7.5%). I do not get the problem here.

Is it normal to work like this? Is it because of the approximations that the saving process does? Or is it something wrong with the process itself?

I used OpenCV 2.4.9, because 3.0.0 is only in beta version.