OpenCV:Traincascade 失败“断言失败 _img.cols == winSize.width”

发布于 2024-08-26 17:51:20 字数 119 浏览 8 评论 0原文

有人知道 OpenCV 错误:断言失败 _img.cols == winSize.width 是什么意思吗?我不熟悉 haar 训练(=traincascade)的新实现,也无法在 wiki 中找到任何文档。 谢谢, 约瑟夫

Anybody has an idea what OpenCV Error: Assertion failed _img.cols == winSize.width means? I'm not familar with the new implemenation of the haar training (=traincascade) nor could I find any documentation in the wiki.
Thanks,
Josef

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

无人问我粥可暖 2024-09-02 17:51:20

我想我已经找到了一些答案:

  • 可能是因为数据库太大(正片和负片图像太多)。
  • 可能是因为正样本差异太大,无法提取一些特征来定义对象;
  • 这也可能是因为底片集可以包含场景(OpenCV 从中生成许多负样本的较大图像),并且包含与正样本非常相似的样本。

但我会选择第一个,因为如果我减少样本数量,它就不会再被卡住了。

I think I have found some answers:

  • It may be because of the too big database (there are too many images positives and negatives).
  • It may be because the positives samples differ too much, there cannot be extracted some features to define the object;
  • It also may be because of the negatives sets, which can contain scenes (bigger images from which OpenCV is generating many negative samples), are containing samples that are very similar to the positive samples.

But I would go for the first one, because if I reduce the number of samples it is not getting stuck anymore.

ゞ花落谁相伴 2024-09-02 17:51:20

数据库太大不是问题,但没有意义。这是我好几天的问题。我猜你在程序中使用了线程,并且你的线程在到达检测器(用于检测关键点)之前到达 svm(或用于训练的其他东西)。如果您查看导致断言错误的路径,您就会发现这些事情是相关的。我建议您使用互斥体(或信号量)来正确管理线程,或者如果您不使用线程,请确保在训练之前进行检测。

祝你好运

Having too big database is not problem, it doesn't make sense . That was my issue for days. I guess you used thread in your program and your threads reach to the svm (or some thing else that you use for train) before get to detector (for detect the keypoints). If you look at the path which give you in assertion error, you got it that these things are relevant. I advice you to use mutex (or semaphores) to manage your threads correctly or if you don't use threads make sure that do detecting before training.

good luck

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文