Faster-RCNN
Contribution:
提出了RPN(Region Proposal Network)和 anchor box, 可以使用神经网络来提取proposal,优点如下:
1)几乎是cost-free的,因为RPN和特征提取的CNN共享参数;
2)RPN可以同时预测bounding box 和 objective score;
3)提出了anchor box,可以用多种宽高比和尺度来预测proposal;
4) 可以使得整个目标检测的网络进行end-to-end training。
Architecture:
在Fast-RCNN的基础上加入了RPN(region proposal network)
1. Shared conv layers: 使用了13个卷积层和4个pooling层来提取图片的feature map, 这部分是Fast RCNN 和RPN共享的;
2. Region Proposal Network: RPN 用于生成region proposals。该层通过softmax判断 achors属于positive 或者negative, 再利用bounding box regression 修正anchors以获得精确的proposals;
3. ROI pooling:根据regional proposal和feature map来提取每个region 对应的feature, 送入后续的全连接层判定目标类别;
4. Classification and Regression:和Fast RCNN类似,这部分主要是完成两个工作:
(1)一个是经过FC layer + softmax进行分类,主要是对object proposal进行分类的,一共是k+1类,包括背景类; (2)另一个是经过FC layer + bbox regressor 输出的,这个就是为k个类各输出4个值。
上图是python版本中的vgg16模型中faster_rcnn_test.pt 的网络结构,该网络对于一幅任意的PxQ的图像,首先缩放至MxN,然后将图像送入网络,而Convlayers中包含了13 conv + 13 relu + 4 pooling; RPN首先经过3x3卷积,在分解生成positive anchors 和对应的bounding box regression偏移量,然后在计算出proposals; 在roi pooling层利用proposals从feature maps中提取proposal feature送入后续的全连接和softmax网络做classification。
RPN 实际包含了两条线:
上面一条通过softmax分类anchors获得positive和negative分类;
下面一条用于计算anchors的bounding box regression偏移量,以获得精确的proposal。最后的proposal层负责综合positive anchors和对应的bounding box regression 偏移量以获取proposals, 同时剔除太小和超出边界的proposals。
ROI pooling: 为何需要roi pooling?
对于传统的CNN, 当网络训练好后输入的图像尺寸必须是固定值,同时网络输出也是固定大小的vector 或 matrix。如果输入图像大小不定,就会出问题。两种解决办法:
1. 从图像中crop一部分传入网络;
2. 将图像warp成需要的大小后传入网络中。
但是无论哪种办法都不好。
ROI pooling 层:
输入shape: (N, W/16, H/16, channels), 为什么除16,因为使用VGG16的话,会经历4个 2*2 的max pooling。
输出shape: (num_rois, expected_H, expected_W, channels), 论文中提出如果使用VGG16的话,expected_H=expected_W=7
RoI pooling 把所有proposals的feature规整到相同大小,比如7x7。
Summary:
Using the produced feature maps from the convolutional layer, we infer regions proposal using a Region Proposal Network rather than relying on an external system. Once we have those proposals, the remaining procedure is the same as Fast-RCNN(forward to ROI layer, classify using SVM and predict the bounding box).The trick part is how to train the whole model as we have multiple tasks that need to be addressed:
1) The region proposal network should decide for each region if it contains an object or not
2) It needs to produce the bounding box coordinates
3) The entire model should classify the objects to categories
4) Again, predict the bounding box offsets
Comments
Post a Comment