【问题标题】:error during Haar Training with TBB using traincascade.exe使用 traincascade.exe 使用 TBB 进行 Haar 训练时出错
【发布时间】:2014-10-20 13:51:21
【问题描述】:

我有大约 931 个裁剪的正样本和 1162 个负样本(非感兴趣对象)。裁剪后的图像分辨率为 54x12,并放置在文件夹中。包含阳性样本的 .txt 文件如下所示:picture1.bmp 1 0 0 54 12。我有一个负片的 .txt 文件,它只包含负片的名称,例如 Noneye001.bmp。

使用的命令: 1.用于.vec文件的生成

C:\Opencv2.4.3\opencv\build\bin\Debug\opencv_createsamplesd.exe -info positive/info.txt -num 931 -vec data/vector.vec -maxxangle 0.6 -maxyangle 0 -maxzangle 0.3 -maxidev 100 -bgcolor 0 -bgthresh 0 -w 54 -h 12

2.用于训练

C:\Opencv2.4.3\opencv\build\bin\Debug\opencv_traincascaded.exe -data data/cascade -vec data/vector.vec -bg negative/infofile.txt -numPos 931 -numNeg 1162 -numStages 20 -precalcValBufSize 256 -precalcIdxBufSize 256 -featureType HAAR -mode ALL -w 54 -h 12

我收到以下错误

PARAMETERS:
cascadeDirName: data/cascade
vecFileName: data/vector.vec
bgFileName: negative/infofile.txt
numPos: 931
numNeg: 1162
numStages: 20
precalcValBufSize[Mb] : 256
precalcIdxBufSize[Mb] : 256
stageType: BOOST
featureType: HAAR
sampleWidth: 54
sampleHeight: 12
boostType: GAB
minHitRate: 0.995
maxFalseAlarmRate: 0.5
weightTrimRate: 0.95
maxDepth: 1
maxWeakCount: 100
mode: ALL

===== TRAINING 0-stage =====
<BEGIN
POS count : consumed   931 : 931
NEG count : acceptanceRatio    1162 : 1
Precalculation time: 41.787
+----+---------+---------+
|  N |    HR   |    FA   |
+----+---------+---------+
|   1|        1|        1|
+----+---------+---------+
|   2|        1|        1|
+----+---------+---------+
|   3| 0.996778| 0.300344|
+----+---------+---------+
END>

===== TRAINING 1-stage =====
<BEGIN
OpenCV Error: Bad argument (Can not get new positive sample. The most possible r
eason is insufficient count of samples in given vec-file.
) in unknown function, file ..\..\..\apps\traincascade\imagestorage.cpp, line 15
9

我尝试增加和减少编号。负样本,但没有帮助。

请帮忙....... 提前致谢。

【问题讨论】:

    标签: opencv


    【解决方案1】:

    这是因为您有 931 张正面图像,并且正在尝试为正面阶段训练 931。

    您需要在每个训练阶段减少此数字,因为它会尝试获取另一个图像。

    把这个调低到 800 看看你怎么过,我想它不会失败的。

    如果您需要更多信息,请参阅 OpenCVAnswers 问题Here

    【讨论】:

      【解决方案2】:

      opencv_createsamples 有一个 -num 参数,用于设置正样本的数量(它不会简单地读取正样本文件中的行数)。如果未设置 -num,则默认值为 1000 个样本。这就是为什么 opencv_traincascade 接近 1000 个样本失败的原因,因为只有 1000 个正样本。 对于更难的问题,您可能需要超过 1000 个样本,因此需要设置 -num 参数。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2014-03-26
        • 2017-12-13
        • 2015-02-08
        • 2014-01-19
        • 2021-05-03
        • 2015-09-12
        • 1970-01-01
        相关资源
        最近更新 更多