我需要一些关于基于 LBP 的人脸检测的帮助,这就是我写这篇文章的原因。
我有以下与 OpenCV 上实现的人脸检测相关的问题:
- 在 lbpCascade_frontal_face.xml 中(来自 opencv):什么是
内部节点、叶值、树、特征等?我知道它们被使用
在算法中。但不明白每一个的意思
其中。例如,为什么我们采用某个特定特征而不是
其他针对特定阶段?我们如何决定哪个功能/
节点选择?
LBP_frontal_face_classifier.xml 中的特征值是什么?我
知道它们是 4 个整数的向量。但我应该如何使用这个
特征?我以为阶段 0 可以访问第一个功能,但是访问
不属于这种模式。此功能的访问模式是什么?
文献中的所有论文仅提供高层次的概述。他们的
描述主要包括邻域LBP计算
像素。但是这个 LBP 值是如何针对这些元素使用的
分类器?
- 积分图像如何帮助计算像素的 LBP 值?
我知道HAAR是如何使用的。我需要了解 LBP。
我读了一些论文、文章。但没有人清楚地描述基于 LBP 的人脸检测的工作原理或详细算法。如果有人想自己开发一个人脸检测程序,他应该遵循什么步骤——没有文档描述这一点。
如果可以的话请帮我解决这些问题。我会很感激。
我向您推荐我的own过去的回答稍微触及了这个主题,但没有解释 XML 级联格式。
让我们看一个fake,修改为clarity仅具有单级和三个功能的级联示例。
<!-- stage 0 -->
<_>
<maxWeakCount>3</maxWeakCount>
<stageThreshold>-0.75</stageThreshold>
<weakClassifiers>
<!-- tree 0 -->
<_>
<internalNodes>
0 -1 3 -67130709 -21569 -1426120013 -1275125205 -21585
-16385 587145899 -24005</internalNodes>
<leafValues>
-0.65 0.88</leafValues></_>
<!-- tree 1 -->
<_>
<internalNodes>
0 -1 0 -163512766 -769593758 -10027009 -262145 -514457854
-193593353 -524289 -1</internalNodes>
<leafValues>
-0.77 0.72</leafValues></_>
<!-- tree 2 -->
<_>
<internalNodes>
0 -1 2 -363936790 -893203669 -1337948010 -136907894
1088782736 -134217726 -741544961 -1590337</internalNodes>
<leafValues>
-0.71 0.68</leafValues></_></weakClassifiers></_>
过了一会儿....
<features>
<_>
<rect>
0 0 3 5</rect></_>
<_>
<rect>
0 0 4 2</rect></_>
<_>
<rect>
0 0 6 3</rect></_>
<_>
<rect>
0 1 4 3</rect></_>
<_>
<rect>
0 1 3 3</rect></_>
...
我们先看一下stage的标签:
- The
maxWeakCount
for a stage is the number of weak classifiers in the stage, what is called in the comments a <!-- tree -->
and what I call an LBP feature.
- The
stageThreshold
is what the weights of the features must add up to at least for the stage to pass.
转向描述 LBP 功能的标签:
- The
internalNodes
are an array of 11 integers. The first two are meaningless for LBP cascades. The third is the index into the <features>
table of <rect>
s at the end of the XML file (A <rect>
describes the geometry of the feature). The last 8 values are eight 32-bit values which together constitute the 256-bit LUT I spoke of in my earlier answer. This LUT is computed by the training process, which I don't fully understand myself.
-
在此示例中,舞台的第一个特征引用矩形
3
, 由四个整数描述 0 1 4 3
.
- The
leafValues
are the two weights (pass/fail) associated with a feature. Depending on the bit selected from the internalNodes
during feature evaluation, one of those two weights is added to a total. This total is compared to the stage's <stageThreshold>
. Then, bool stagePassed = (sum >= stageThreshold - EPS);
, where EPS
is 1e-5, determines whether the stage has passed or failed. The weights are also determined by the training process.
-
在此示例中,第一个特征的失败权重是
-0.65
并且通过权重是 0.88
.
最后,<feature>
标签。它由一个数组组成<rect>
包含 4 个描述特征几何形状的整数的标签。给定一个处理窗口(在您的情况下为 24x24),前两个整数描述其x
and y
整数像素offset在处理窗口内,接下来的两个整数描述了width and height评估 LBP 特征所需的 9 个子矩形中的一个。
本质上来说,一个标签<rect> ft.x ft.y ft.width ft.height </rect>
位于处理窗口内pW.width
xpW.height
检查人脸是否存在pW.x
xpW.y
对应于...
为了评估 LBP,只需读取点处的积分图像即可p[0..15]
并使用p[BR]+p[TL]-p[TR]-p[BL]
计算九个子矩形的积分。这central子矩形 R4 与其他八个子矩形进行比较,从 R0 开始按顺时针方向,生成 8 位 LBP(这些位被打包 [msb 01258763 lsb])。
然后,将此 8 位 LBP 用作该特征的 (2^8 = 256) 位 LUT 的索引(<internalNodes>
),选择单个位。如果该位为1,则该特征与人脸不一致;如果为0,则与人脸一致。合适的重量(<leafNode>
)然后返回并与所有其他特征的权重相加以产生总体阶段总和。然后将其与<stageThreshold>
以确定该阶段是否通过或失败。
如果还有什么我没有解释清楚的地方我可以澄清。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)