opencv_traincascade构建中间结果 [英] opencv_traincascade build intermediate result

查看:100
本文介绍了opencv_traincascade构建中间结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用opencv_trainscascade训练haar级联.它运行良好,但是我想将每个阶段生成的各种xml文件合并到可用的输出中.使用./convert_cascade --size ="XxX" output.xml给我一个错误.我知道使用opencv_haartraining可以很好地产生中间结果,但是有没有办法对较新的版本执行相同的操作?

I'm training a haar cascade using opencv_trainscascade. Its running fine, but I'd like to combine the various xml files generated from each stage into a usable output. Using the ./convert_cascade --size="XxX" output.xml is giving me an error. I know that that worked with opencv_haartraining fine to generate an intermediate result, but is there a way to do the same for the newer version?

OpenCV Error: Parsing error (classifier(0): Valid XML should start with '<?xml ...?>') in icvXMLParse, file /tmp/opencv-qGZ4sE/opencv-2.4.9/modules/core/src/persistence.cpp, line 2252
libc++abi.dylib: terminating with uncaught exception of type cv::Exception: /tmp/opencv-qGZ4sE/opencv-2.4.9/modules/core/src/persistence.cpp:2252: error: (-212) classifier(0): Valid XML should start with '<?xml ...?>' in function icvXMLParse

Abort trap: 6

目录中的所有xml文件看起来都很好.

All the xml files in the directory seem fine.

推荐答案

一些人挖掘得出了这样的结论:

Some digging around yielded this:

convert_cascade用于通过haartraining应用程序训练的级联,它不支持通过traincascade应用程序训练的级联的格式.

convert_cascade is for cascades trained by haartraining application and it does not support a format of cascades trained by traincascade application.

要使用traincascade做到这一点,只需使用相同的"-data"再次运行opencv_traincascade,但将"-numStages"设置为要生成的最大点.应用程序将加载经过训练的阶段,意识到需要的阶段数,将结果级联写入xml中并完成工作.在阶段中中断该过程可能会导致数据损坏,因此,最好是在完成时删除该阶段.

To do this with traincascade, just run opencv_traincascade again with the same "-data" but set "-numStages" to the point you want to generate up to. The application will load the trained stages, realize that there is required number of stages, write the result cascade in xml and finish a work. Interrupting the process during a stage could result in corrupt data, so if you're best off deleting the stage in completion.

这篇关于opencv_traincascade构建中间结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆