Object localization
监督学习
训练样本中给出bounding box的中心点坐标和长宽,bx,by,bw,bh
Need to output bx,by,bw,bh,class label and Pc(is there any object?存在物体的置信度。当不存在物体的时候,loss函数只需计算Pc的准确度,其他项都不用考虑)。Y的维数为(1+4+class labels)。
Landmark detection
特征点检测
需要输出一个是否有物体的置信度Pc,以及每个特征点的(x,y)坐标,所有训练集样本需包含这些labels。
面部表情识别,人体关键点检测。
Object detection
sliding windows
训练:根据滑动窗口的大小,使用适当裁剪的训练集样本,训练是否图片中有需要检测的物体物体。
检测:滑动窗口目标检测,对每一个窗口做一次检测,得到一个label,直到遍历图像每个区域。
缺点:computation expensive。步幅大时,粗粒度会影响检测性能,无法准确定位;细粒度或小步幅时计算成本高。所以一般使用简单的线性分类器。
convolutional implementation of sliding windows
Turning FC layer into convolutional layers
没有全连接层时,输入图片的大小可以改变。
该卷积操作的原理是:不需要将需检测的输入图片分割成滑窗的大小的子集,分贝执行前向传播;而是直接将图片输入给卷积网络,其中的公共区域可以共享很多计算,一次性输出所有检测值。但边界框位置可能不够准确。
bounding box prediction
YOLO algorithm
一个格子只存在一个物体时
用一个网格划分输入图片(33)
Labels for training for each grid cell:置信度Pc,bx,by,bw,bh, class labels
将物体分配给中心所在的格子(训练集中该格子的Pc=1)
output dimension:(1+4+class labels)\3*3,
bx,by,bw,bh are specified relative to the grid cell(bbox中心所在cell的左上角坐标为0,右下角为1,bx,by是相对(0,0)的偏移量,值在0到1之间;bw,bh是bbox的长宽与grid cell边长的比值,可大于1。可以用sigmoid等函数处理,使其位于0到1之间)
Intersection over Union
“Correct” if IoU>=0.5(human chosen)
the predicted bbox with the ground truth(prior bbox)
Non-max Suppresion
确保每个物体只被检测出一次。
先去掉所有Pc小于一定阈值的边界框(认为没有检测到物体),找出检测结果中Pc最大的bbox,然后去掉与其IoU大于阈值的检测框;再选择剩下的bbox中概率最高的…直到处理完所有框。
如果图像中有多中类别的物体,应该分别对每种label各独立做一次NMS。
Anchor box
使一个grid cell可以检测出多个物体。
Previously:
each object in training image is assigned to grid cell that contains that object’s midpoint.
With anchor boxes:
each object in training image is assigned to grid cell that contains object’s midpoint and anchor box for the grid cell with highest IoU. match with (grid cell, anchor box).
for each grid cell, the output Y dimension is (1+4+class labels)*anchor boxes.
use k-means algorithm to choose anchor box.
grid cells越多,一个cell中出现多个物体的可能性更小。
Region proposal network(RPN)
two stages
利用图像分割算法,选出候选区域,在每种色块(blobs)上跑分类器。先找出可能的2000个色块,然后在这些色块上放置bbox,在这些色块上跑分类器。
R-CNN: Propose regions. Classify proposed regions one at a time. Output label + bounding box.
Fast R-CNN: Propose regions. Useconvolution implementation of sliding windows to classify all the proposed regions.
Faster R-CNN: Use convolutional network to propose regions.