AdaBoost训练出现问题:Train dataset for temp stage can not be filled
来源:互联网 发布:java string变量类型 编辑:程序博客网 时间:2024/06/07 15:57
F:\boost5>cd bin
F:\boost5\bin>opencv_traincascade.exe -data ../cascade -vec ../pos/sample_pos.ve
c -bg sample_negative.dat -numPos 3950 -numNeg 4479 -featureType LBP -w 24 -h 24
-numStages 15 -mem 1024
PARAMETERS:
cascadeDirName: ../cascade
vecFileName: ../pos/sample_pos.vec
bgFileName: sample_negative.dat
numPos: 3950
numNeg: 4479
numStages: 15
precalcValBufSize[Mb] : 1024
precalcIdxBufSize[Mb] : 1024
acceptanceRatioBreakValue : -1
stageType: BOOST
featureType: LBP
sampleWidth: 24
sampleHeight: 24
boostType: GAB
minHitRate: 0.995
maxFalseAlarmRate: 0.5
weightTrimRate: 0.95
maxDepth: 1
maxWeakCount: 100
Number of unique features given windowSize [24,24] : 8464
===== TRAINING 0-stage =====
<BEGIN
POS count : consumed 3950 : 3950
Train dataset for temp stage can not be filled. Branch training terminated.
Cascade classifier can't be trained. Check the used training parameters.
F:\boost5\bin>pause
请按任意键继续. . .
解决:路径问题
F:\boost5>cd bin
F:\boost5\bin>opencv_traincascade.exe -data ../cascade -vec ../pos/sample_pos.ve
c -bg sample_negative.dat -numPos 3950 -numNeg 4479 -featureType LBP -w 24 -h 24
-numStages 15 -mem 1024
PARAMETERS:
cascadeDirName: ../cascade
vecFileName: ../pos/sample_pos.vec
bgFileName: sample_negative.dat
numPos: 3950
numNeg: 4479
numStages: 15
precalcValBufSize[Mb] : 1024
precalcIdxBufSize[Mb] : 1024
acceptanceRatioBreakValue : -1
stageType: BOOST
featureType: LBP
sampleWidth: 24
sampleHeight: 24
boostType: GAB
minHitRate: 0.995
maxFalseAlarmRate: 0.5
weightTrimRate: 0.95
maxDepth: 1
maxWeakCount: 100
Number of unique features given windowSize [24,24] : 8464
===== TRAINING 0-stage =====
<BEGIN
POS count : consumed 3950 : 3950
NEG count : acceptanceRatio 4479 : 1
Precalculation time: 2.641
+----+---------+---------+
| N | HR | FA |
+----+---------+---------+
| 1| 1| 1|
+----+---------+---------+
| 2| 0.997215|0.0618442|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 0 minutes 4 seconds.
===== TRAINING 1-stage =====
<BEGIN
POS count : consumed 3950 : 3961
NEG count : acceptanceRatio 4479 : 0.072789
Precalculation time: 2.729
+----+---------+---------+
| N | HR | FA |
+----+---------+---------+
| 1| 1| 1|
+----+---------+---------+
| 2| 0.998987|0.0707747|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 0 minutes 8 seconds.
===== TRAINING 2-stage =====
<BEGIN
POS count : consumed 3950 : 3965
NEG count : acceptanceRatio 4479 : 0.00551266
Precalculation time: 2.679
+----+---------+---------+
| N | HR | FA |
+----+---------+---------+
| 1| 1| 1|
+----+---------+---------+
| 2| 0.999241|0.0645233|
+----+---------+---------+
END>
Training until now has taken 0 days 0 hours 0 minutes 16 seconds.
===== TRAINING 3-stage =====
<BEGIN
POS count : consumed 3950 : 3968
NEG current samples: 1173
问题:
http://villager5.blog.163.com/blog/static/8273636201462452037527/
===== TRAINING 1-stage =====
<BEGIN
POS count : consumed 10 : 10
Train dataset for temp stage can not be filled. Branch training terminated.
Cascade classifier can't be trained. Check the used training parameters.
I took me the whole afternoon to find the solution by google, some other guys have the same problem like me as discussed in this topic: http://answers.opencv.org/question/16868/error-in-train-casacde/
Why?
The reason is very simple, in your opencv folder, find "opencv-2.4.6.1 -> apps -> traincascade ", open "imagestorage.cpp", in function "bool CvCascadeImageReader::NegReader::create( const String _filename, Size _winSize )", we can see that all the image file names in negInfo.txt are read into imgFilenames by std:getline. It seems right! But only if you have used ubuntu to generate the negInfo.txt. If you have used windows (what I did) to generate this text file, there would be two chars at the end of each line \r\n; on linux there is just one, \n. So, with the original code in opencv, the \r is kept at the end of each file name. Then, in Line 60, "src = imread( imgFilenames[last++], 0 )", the image file can't be loaded.
So, there are two solutions:
1) generate your bt.txt (negative sample file) on Ubuntu, make sure that there is a newline for each image file no empty line in the whole file;
2) or generate your bt.txt (negative sample file) on Windows, but add one line in the original opencv code "imagestorage.cpp":
before line 45, add "
if (str[str.size() - 1] == '\r')
str.resize(str.size() - 1); // to erase \r if the file is generated by windows"; then, recompile (cmake .. -> make -> make install) your opencv for a new opencv_traincascade application.
解决方法:http://blog.csdn.net/forest_world/article/details/71082036
转载请注明:http://blog.csdn.net/forest_world
- AdaBoost训练出现问题:Train dataset for temp stage can not be filled
- 训练出现“Train dataset for temp stage can not be filled. Branch training terminated ..."解决方法
- 在opencv中训练cascade分类器,出现Train dataset for temp stage can not be filled
- 第二十五篇:traincascade训练报错:Train dataset for temp stage can not be filled.
- traincascade训练报错:Train dataset for temp stage can not be filled.
- Faster RCNN训练出现问题:ValueError: operands could not be broadcast together with shapes
- Can not be copied
- 编译动态库出现问题relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object
- sysfs: duplicate filename 's3c2440-nand' can not be created。linux2.6的内核编译中出现的问题
- FindBugs:Compiler output path for module can not be null. check your module/project settings问题原因
- FindBugs:Compiler output path for module can not be null. check your module/project settings问题原因
- column can not be re-read 问题的解决办法
- Report view 出现Native compiler return value: ‘[BC2001] file 'C:/WINDOWS/TEMP/gwud19ll.0.vb ' could not be fou
- SQLServer2000编程中出现的异常:ResultSet can not re-read row data for column X 问题
- var can not be resolved
- Adaboost +HOG/LBP/HAAR 训练问题
- Ubuntu运行Chrome出现“Google Chrome can not be run as root”的解决方法
- Myeclipse出现can not be found.please check the location and try again
- Jvascript正则表达式 学习
- el表达式截取时间字符串
- C语言学习历程——编程练习2——09
- Java解惑学习有感(六)---库之谜
- 离散基础 (9). 整除性
- AdaBoost训练出现问题:Train dataset for temp stage can not be filled
- 【Android】Android 4.0 Camera架构分析之Camera初始化
- 神经网络压缩:Mimic(一)Do Deep Nets Really Need to be Deep
- 如何手动关闭tomcat服务,不在Eclipse中的server里按那个红色按钮关。
- 图论矩乘——BZOJ1297 [SCOI2009]迷路
- Source Insight 中文乱码终极解决
- 设置html网页只能在微信中打开,并禁用分享功能
- ubuntu下g++报错 g++:command not found解决办法
- option操作