Haar培训:错误(-215)_img.row * _img.cols == vecSize在函数中 [英] Haar Training: error (-215)_img.row * _img.cols == vecSize in function

查看:557
本文介绍了Haar培训:错误(-215)_img.row * _img.cols == vecSize在函数中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试训练Haar级联以检测手.我有一个大小为1000的vec文件. 我有40张正面图片和600张负面图片.我已经尝试过丢弃正面图片和负面图片.当我运行以下命令时,出现以下错误:

I am trying to train a Haar Cascade to detect hands. I have a vec file of size 1000. I have 40 positive images and 600 negative images. I have tried both dropping my positive images and negative images. When I run the following command I receive the following error:

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

已中止(核心已弃用)

我尝试降低正计数并再次执行整个过程,但仍然收到相同的错误.有什么建议吗?

I tried lowering my positive count and doing the whole process over again and still received the same error. Any suggestions?

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

By the way: I am following the tutorial at : http://coding-robin.de/2013/07/22/train-your-own-opencv-haar-classifier.html

谢谢

推荐答案

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

The error does not seem to be a result of large number of positive or negative samples. People do train very large data sets!

从上述参数可以看出,构成样本.vec的正样本的尺寸为24x24,由以下语句表示:

From the parameters described above, it can be noticed that the dimension of the positive samples that form the samples.vec is 24x24, which is denoted by the statement:

sampleWidth: 24
sampleHeight: 24

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

But while calling the opencv_traincascade function, you try to set the dimension as 80x40. Try changing this to -w 24 -h 24

这篇关于Haar培训:错误(-215)_img.row * _img.cols == vecSize在函数中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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