Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Convert opencv_traincascade intermediate output into xml

I began training a cascade classifier

opencv_traincascade -data cascade -bg neg.txt -vec pos.vec -numPos 1000 -numNeg 1000 -w 48 -h 48

and partway in I killed the program, giving me intermediate output:

$ ls cascade/

params.xml

stage0.xml

stage1.xml

stage2.xml

stage3.xml

stage4.xml

stage5.xml

Now I would like to convert this into an XML file. I tried to use c-example-convert_cascade

c-example-convert_cascade --size="48x48" ./cascade cascade.xml

But got the following error:

OpenCV Error: Parsing error (./cascade(0): Valid XML should start with '') in icvXMLParse, file /home/jmuncaster/OutsideSource/opencv/modules/core/src/persistence.cpp, line 2227 terminate called after throwing an instance of 'cv::Exception' what(): /home/jmuncaster/OutsideSource/opencv/modules/core/src/persistence.cpp:2227: error: (-212) ./cascade(0): Valid XML should start with '' in function icvXMLParse

Question: How do I convert the intermediate output to an XML file readable by cv::CascadeClassifier?