如何解决尝试使用opencv_createsamples
我正在尝试训练级联以检测面部。我有31张带有面孔的图片,并且使用了opencv_annotation
工具生成了-info
文件。该文件如下所示:
1 positiveImages/0.jpg 1 546 289 70 96
2 positiveImages/1.jpg 1 542 325 105 106
3 positiveImages/10.jpg 1 98 289 138 119
4 positiveImages/11.jpg 1 284 303 204 189
5 positiveImages/12.jpg 3 415 279 70 97 484 320 75 87 624 374 76 132
...
此后,我尝试使用opencv_createsamples
工具生成.vec
-文件,用于训练级联。这是我使用的命令:
opencv_createsamples -info file.txt -bg negatives.txt -vec cropped.vec -num 1920 -w 48 -h 48
这给我以下输出错误:
Info file name: file.txt
Img file name: (NULL)
Vec file name: cropped.vec
BG file name: negatives.txt
Num: 1920
BG color: 0
BG threshold: 80
Invert: FALSE
Max intensity deviation: 40
Max x angle: 1.1
Max y angle: 1.1
Max z angle: 0.5
Show samples: FALSE
Width: 48
Height: 48
Create training samples from images collection...
OpenCV Error: Assertion failed (ssize.area() > 0) in resize,file /home/travis/miniconda/conda-bld/conda_1486587069159/work/opencv-3.1.0/modules/imgproc/src/imgwarp.cpp,line 3229
terminate called after throwing an instance of 'cv::Exception'
what(): /home/travis/miniconda/conda-bld/conda_1486587069159/work/opencv-3.1.0/modules/imgproc/src/imgwarp.cpp:3229: error: (-215) ssize.area() > 0 in function resize
Aborted (core dumped)
据我所知,此错误想告诉我没有图像,对吗?我不知道为什么会这样。 file.txt
似乎还可以,它具有用于图像等的正确路径。我们将不胜感激任何建议。
编辑。想知道是否有更好的方法来训练级联,例如使用几千张人脸图片和几千张没有人脸且不使用注释工具的图片?如果正像被裁剪为仅包含脸部,我可以以某种方式使用这两个文件夹进行训练吗?
编辑。我的文件夹结构是这样的:
/negativeImages
/positiveImages
file.txt
negatives.txt
我正在从根目录运行opencv_createsamples
。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。