How to import new data for example bagofwords_classification.cpp ? (Feature #1750)
Description
We read the VOC specification document, XML file format, and the VOC2010 parser in the opencv example. Accordingly, we have imported our annotated image data for the recent svn opencv code, built the vocabulary, and attempted some SVM options.
Please correct me if I am in err, or missing a crucial assumption in the following:
1.)
For classification there are four sets for xml file lists:
"train": Training data
"val": Validation data
"trainval": The union of train and val.
"test": Test data.
The OpenCV default file suffix used when the new VOC class loads with VocData
vocData( vocPath, false ):
m_train_set = "train";
m_test_set = "val";
2.)
There are three truth labels:
-1: Negative: The image contains no objects of the class of interest.
1: Positive: The image contains at least one object of the class of interest.
0: "Difficult": The image contains only objects of the class of interest marked as 'difficult'.
3.)
I assumed there are no "0: "Difficult" entries in our small test data set.
Repository Root: https://code.ros.org/svn/opencv
Revision: 7292
./bagofwords_classification VOC2010 voctest SURF OpponentSURF BruteForce
...
Using 2758 of 5515 descriptors for training (50 %)
TRAINING SVM FOR CLASS ...snoopy...
35 positive training samples; 2723 negative training samples
SVM TRAINING FOR CLASS snoopy COMPLETED
SAVED CLASSIFIER TO FILE
- CALCULATING CONFIDENCES FOR CLASS snoopy ***
CALCULATING BOW VECTORS FOR TEST SET OF snoopy...
Computing descriptors for image 4994 of 5515 (0000_4993) + generating BoW vector ...DONE 90 % complete
CALCULATING CONFIDENCE SCORES FOR CLASS snoopy...(0000_5514)
OpenCV Error: Bad argument (The sample is not a valid vector) in cvPreparePredictData, file /home/yourmom/opencv/modules/ml/src/inner_functions.cpp, line 1099
terminate called after throwing an instance of 'cv::Exception'
what(): /home/yourmom/opencv/modules/ml/src/inner_functions.cpp:1099: error: (-5) The sample is not a valid vector in function cvPreparePredictData
Thanks,
J
Associated revisions
Merge pull request #1750 from alalek:ocl_update_documentation
History
Updated by Maksim Shabunin over 9 years ago
Issue has been transferred to GitHub: https://github.com/Itseez/opencv/issues/4341