gpt4 book ai didi

python - Haar Training : error (-215)_img. row * _img.cols == vecSize 函数

转载 作者:太空狗 更新时间:2023-10-29 22:30:12 26 4
gpt4 key购买 nike

我正在尝试训练 Haar Cascade 来检测手部。我有一个大小为 1000 的 vec 文件。我有 40 张正面图片和 600 张负面图片。我试过放弃我的正面形象和负面形象。当我运行以下命令时,我收到以下错误:

opencv_traincascade -data classifier -data classifier -vec samples.vec -bg negatives.txt
-numstages 20 -minHitRate 0.999 -maxFalseAlarmRate 0.5 -numPos 1000\ -numNeg 600 -w 80
-h 40 -mode ALL -precalcValBufSize 1024\ -precalcIdxBufSize 1024

PARAMETERS:
cascadeDirName: classifier
vecFileName: samples.vec
bgFileName: negatives.txt
numPos: 1000
numNeg: 1000
numStages: 20
precalcValBufSize[Mb] : 256
precalcIdxBufSize[Mb] : 256
stageType: BOOST
featureType: HAAR
sampleWidth: 24
sampleHeight: 24
boostType: GAB
minHitRate: 0.999
maxFalseAlarmRate: 0.5
weightTrimRate: 0.95
maxDepth: 1
maxWeakCount: 100
mode: BASIC



===== TRAINING 0-stage =====
<BEGIN
OpenCV Error: Assertion failed (_img.rows * _img.cols == vecSize) in get, file /home/lie/Desktop/Install-OpenCV-master/Ubuntu/2.4/OpenCV/opencv-2.4.9/apps/traincascade/imagestorage.cpp, line 157
terminate called after throwing an instance of 'cv::Exception'
what(): /home/lie/Desktop/Install-OpenCV-master/Ubuntu/2.4/OpenCV/opencv-2.4.9/apps/traincascade/imagestorage.cpp:157: error: (-215) _img.rows * _img.cols == vecSize in function get

中止(核心转储)

我尝试降低阳性计数并重新执行整个过程,但仍然收到相同的错误。有什么建议吗?

顺便说一句:我正在按照以下教程进行操作:http://coding-robin.de/2013/07/22/train-your-own-opencv-haar-classifier.html

谢谢

最佳答案

错误似乎不是大量正样本或负样本的结果。人们确实会训练非常大的数据集!

从上面描述的参数可以看出,构成samples.vec的正样本的维度是24x24,用语句表示:

sampleWidth: 24
sampleHeight: 24

但是在调用 opencv_traincascade 函数时,您尝试将维度设置为 80x40。尝试将其更改为 -w 24 -h 24

关于python - Haar Training : error (-215)_img. row * _img.cols == vecSize 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27726973/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com