opencv Haartraining
2016-07-26 11:19
393 查看
如何利用OpenCV自带的haar training程序训练分类器 - 计算机视觉小菜鸟的专栏 - 博客频道 - CSDN.NET http://blog.csdn.net/carson2005/article/details/8171571
基于opencv的haar算法以人脸识别为例的训练分类器xml的方法 - - 博客频道 - CSDN.NET http://blog.csdn.net/tender8888/article/details/7278091
opencv haar+adaboost使用心得 . - liulina603的专栏 - 博客频道 - CSDN.NET http://blog.csdn.net/liulina603/article/details/8197889
参考了以上几篇博客
1、自己编译了opencv application下的opencv_haartraining,勾选了OpenMp选项vs--->project-->properties-->c++-->language-->OpenMp support
2、提取的正样本样本总共6729,负样本315张图片,参考使用心得这篇文章,输入opencv_haartraining.exe -data xml -vec pos.vec -bg neg\neg.txt -w 20 -h 20 -mem 1024 -npos 6729 -nneg 6729 -nstages 22 出错。OpenCV
Error: Assertion failed (elements_read == 1) in unknown function, file ..\..\..\..\opencv\apps\haartraining\cvhaartraining.cpp, line 1859
别人也遇到这个问题,c++ - haar training OpenCV assertion failed - Stack Overflow http://stackoverflow.com/questions/10863560/haar-training-opencv-assertion-failed
The
problem is that your vec-file has exactly the same samples count that you passed in command line -numPos 979. Training application used all samples from the vec-file to train 0-stage and it can not get new positive samples for the next stage training because
vec-file is over. The bug of traincascade is that it had assert() in such cases, but it has to throw an exception with error message for a user. It was fixed in r8913. -numPose is a samples count that is used to train each stage. Some already used samples
can be filtered by each previous stage (ie recognized as background), but no more than (1 - minHitRate) * numPose on each stage. So vec-file has to contain >= (numPose + (numStages-1) * (1 - minHitRate) * numPose) + S, where S is a count of samples from vec-file
that can be recognized as background right away. I hope it can help you to create vec-file of correct size and chose right numPos value.
所以我的npos 跟 nneg过大,应参考上面这个公式。vec-file has to contain >= (numPos + (numStages-1) * (1 - minHitRate) * numPos)
+ S
重新训练:opencv_haartraining.exe -data xml -vec pos.vec -bg neg\neg.txt -w 20 -h 20 -mem 1024 -npos 3000 -nneg 315 -nstages 22
基于opencv的haar算法以人脸识别为例的训练分类器xml的方法 - - 博客频道 - CSDN.NET http://blog.csdn.net/tender8888/article/details/7278091
opencv haar+adaboost使用心得 . - liulina603的专栏 - 博客频道 - CSDN.NET http://blog.csdn.net/liulina603/article/details/8197889
参考了以上几篇博客
1、自己编译了opencv application下的opencv_haartraining,勾选了OpenMp选项vs--->project-->properties-->c++-->language-->OpenMp support
2、提取的正样本样本总共6729,负样本315张图片,参考使用心得这篇文章,输入opencv_haartraining.exe -data xml -vec pos.vec -bg neg\neg.txt -w 20 -h 20 -mem 1024 -npos 6729 -nneg 6729 -nstages 22 出错。OpenCV
Error: Assertion failed (elements_read == 1) in unknown function, file ..\..\..\..\opencv\apps\haartraining\cvhaartraining.cpp, line 1859
别人也遇到这个问题,c++ - haar training OpenCV assertion failed - Stack Overflow http://stackoverflow.com/questions/10863560/haar-training-opencv-assertion-failed
The
problem is that your vec-file has exactly the same samples count that you passed in command line -numPos 979. Training application used all samples from the vec-file to train 0-stage and it can not get new positive samples for the next stage training because
vec-file is over. The bug of traincascade is that it had assert() in such cases, but it has to throw an exception with error message for a user. It was fixed in r8913. -numPose is a samples count that is used to train each stage. Some already used samples
can be filtered by each previous stage (ie recognized as background), but no more than (1 - minHitRate) * numPose on each stage. So vec-file has to contain >= (numPose + (numStages-1) * (1 - minHitRate) * numPose) + S, where S is a count of samples from vec-file
that can be recognized as background right away. I hope it can help you to create vec-file of correct size and chose right numPos value.
所以我的npos 跟 nneg过大,应参考上面这个公式。vec-file has to contain >= (numPos + (numStages-1) * (1 - minHitRate) * numPos)
+ S
重新训练:opencv_haartraining.exe -data xml -vec pos.vec -bg neg\neg.txt -w 20 -h 20 -mem 1024 -npos 3000 -nneg 315 -nstages 22
相关文章推荐
- 将GPS坐标转换成百度地图坐标,将baidu 经纬度 转换为google经纬度
- [219] Contains Duplicate II
- pthread_key泄露问题检测
- (HDU 5728)2016 Multi-University Training Contest 1 PowMod(数论)
- 1086. Tree Traversals Again (25)
- 游戏编程中的人工智能技术-扫雷机系列
- SLA by Short brain-July-2016
- 7.5 obtaining database metadata
- HDU 4300 Clairewd’s message 扩展kmp || kmp
- (LeetCode)Contains Duplicate -- 查看数组是否重复
- hihocoder #1341 Constraint Checker
- 杭电-1702 ACboy needs your help again!(栈&队列)
- POJ1363:Rails(栈)
- poj 1363 Rails 【栈】
- Repair the Wall
- 2016 Multi-University Training Contests
- What it means for machine intelligence and AI-Christopher Nguyen
- 【 POJ 1363 】Rails
- LeetCode:Contains Duplicate
- tail、head 命令用法