gpt4 book ai didi

opencv - 如何实现更好的滑动窗口算法?

转载 作者:太空宇宙 更新时间:2023-11-03 20:48:51 24 4
gpt4 key购买 nike

所以我一直在为 HoG 及其变体编写自己的代码以处理深度图像。但是,我仍然坚持在检测窗口部分测试训练有素的 SVM。

我现在所做的就是首先从原始图像创建图像金字塔,然后从左上角到右下角运行一个 64x128 大小的滑动窗口。

这是它的视频截图:http://youtu.be/3cNFOd7Aigc

现在的问题是我得到的误报比我预期的要多。

有没有一种方法可以消除所有这些误报(除了使用更多图像进行训练外)?到目前为止,我可以从 SVM 获得“分数”,这是到边距本身的距离。我如何利用它来影响我的结果?

有没有人对实现良好的滑动窗口算法有任何见解?

最佳答案

您可以做的是添加一个处理步骤,以从 SVM 中找到局部最强的响应。让我解释一下。

你现在似乎在做什么:

for each sliding window W, record category[W] = SVM.hardDecision(W)

硬决策意味着它返回一个 bool 值或整数,对于二类分类可以这样写:

hardDecision(W) = bool( softDecision(W) > 0 )

由于您提到了 OpenCV,在 CvSVM::predict 中您应该将 returnDFVal 设置为 true :

returnDFVal – Specifies a type of the return value. If true and the problem is 2-class classification then the method returns the decision function value that is signed distance to the margin, else the function returns a class label (classification) or estimated function value (regression).

来自 the documentation .

你可以做的是:

  1. for each sliding window W, record score[W] = SVM.softDecision(W)
  2. for each W, compute and record:
    • neighbors = max(score[W_left], score[W_right], score[W_up], score[W_bottom])
    • local[W] = score[W] > neighbors
    • powerful[W] = score[W] > threshold.
  3. for each W, you have a positive if local[W] && powerful[W]

由于您的分类器会对窗布(在空间和/或外观上)做出积极响应,从而达到真正的积极效果,因此我们的想法是记录每个 window 的分数,然后仅保留积极的

  • 是局部最大分数(大于它的邻居)--> local
  • 足够强大 --> 强大

您可以将阈值设置为 0 并进行调整,直到获得满意的结果。或者您可以使用您的训练集自动校准它。

关于opencv - 如何实现更好的滑动窗口算法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15874445/

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