小工具知识网

当前位置: 首页 > 行业知识 > 【深度学习】目标检测神经网络1/2

行业知识

【深度学习】目标检测神经网络1/2

2026-11-12 13:56:09 来源:互联网转载

目标检测神经网络

概念

���型分类有三种:图像分类即输出图像类别和概率;单目标检测,输出目标的概率和位置;多目标检测,同时输出多个目标的分类、位置、概率。

()

位置检测分为两种形式:一种是矩形框;另一种是关键点。

交并比,Intersection Over Union,模型推理的矩形框与真值矩形框的重叠度,用于判断结果精度。

()

非极大值抑制:从同一目标上的多个矩形框筛选最好的一个。

算法流程:

  1. 剔除概率小于阈值的框
  2. 从剩余的框中选择概率最大的
  3. 剔除与前框IOU大于阈值的框,重复步骤2,直到唯一

NMS iteratively removes lower scoring boxes which have an IoU greater than iou_threshold with another (higher scoring) box.

典型方法介绍

从流程上可分为一步、两步检测方法两大类,前者以YOLO系列等模型为代表,后者即RCNN系列,YOLO的主要流程:

  1. 将图像划分GxG个网格
  2. 对每一个网格图像做CNN预测
  3. 对重叠的框运行NMS

本篇主要介绍RCNN系列。

Region-based CNN系列

RCNN系列是典型的两步检测:先找ROI,再对ROI识别。

用颜色、纹理(灰度)直方图判断两个候选区域是否相近。

图像尺度是有限的,所以用随机选区域做目标检测是可行的。

用CNN对每个候选框提取固定长度特征向量。

将不同大小的候选框做缩放,RCNN论文采用各项异性缩放、padding=16的精度最好。

RCNN基本流程:

a. 提取2k个候选区域

b. 合并候选区域

c. 对区域做填充、缩放,提取卷积特征

d. 用各类各自的SVM判断是否为某一类型。为什么用SVM而不是分类网络,负样本的定义是与GT的IOU CNN(Conv + Max pooling) > feature map

region proposal + feature map > ROI pooling > feature vector > 2 sibling FC layers

其中,

FC > softmax > cls

FC > bbox (4 values)

ROI pooling 是max pooling,FastRCNN论文把一个ROI划分为7*7个子窗口,每个子窗口做max-pooling,输出特征向量。

示例,设图像尺寸为40x40,CNN提取的featureX的尺寸为4x4,设图像上ROI的左上、右下点坐标为(0,0,20,20)、(0,10,30,30),则应从X[0:3,0:3]和[1:4,0:4]做max-pooling。

Faster-RCNN

使用Region Proposal Network替换selective search,实现region proposal,模型其他结构不变。

Region Proposal Network

“Region Proposal algorithms hypothesize object locations. An RPN is a fully convolutional network that simultaneously predicts object bounds and objectness scores at each position. On top of these convolutional features, we construct an RPN by adding a few additional convolutional layers

that simultaneously regress region bounds and objectness scores at each location on a regular grid.”

对feature map做卷积,获取一个新的通道为c的feature map,每个像素生成一系列不同尺寸和宽高比的anchor box,各个box中心像素的长度为c的特征向量推理objectness,回归其坐标,采用非极大值抑制合并重叠的目标,输出目标候选框进入ROI pooling。

代码

原版

rbgirshick使用caffe框架,feature map的通道维数512,经过RPN的第一层卷积,平行过分类层和坐标回归层;分类时HW不变,通道数变为18,指示9个anchor的objectness,分为bg与fg;回归坐标时HW不变,通道数变为36,即9个anchor的坐标。在RoI-Head网络中,将RoI区域对应的feature map进行截取,而后利用RoI pooling层输出7*7大小的feature map。

mmdetection

TwoStageDetector衍生Fast-RCNN

残差计算在函数forward_train()

Related Works

Object Proposal

As external modules independent of detectors.

Grouping super-pixels: Selective Search

Sliding windows: EdgeBoxes

Deep Networks for Object Detection

OverFeat uses a fully-connected layer to predict bounding-box coordinates. The FC is turned into a convolutional layer for multiple class-specific objects.

MultiBox generates region proposals with a network whose last FC predicts multiple class-agnostic boxes.

We discuss OverFeat and MultiBox in more depth later in context with our method.

参考:

  1. RCNN论文
  2. Fast-RCNN论文
  3. Faster-RCNN论文
  4. rbgirshick的Fast-RCNN

上一篇:QTreeWidget双击节点响应

下一篇:怎么刷新抖音服务器地址?