Skip to content

Commit f7d04aa

Browse files
committed
docs(ssd): ssd算法概述和基础网络介绍
1 parent 4cbf77a commit f7d04aa

File tree

9 files changed

+145
-3
lines changed

9 files changed

+145
-3
lines changed

docs/index.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
1. 配置模块
1010
2. 日志模块
1111
3. 数据模块
12-
4. 优化器模块
12+
4. 检测器模块
13+
5. 优化器模块
1314

1415
## SSD算法
1516

16-
。。。
17+
* 引言
18+
* 基础网络

docs/model/index.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2+
# 检测器
3+
4+
对于目标检测训练框架而言,检测器模块集成了以下几个部分:
5+
6+
1. 特征提取
7+
2. 分类/检测
8+
3. 损失函数计算
9+
1. 定位损失
10+
2. 置信度损失
11+
12+
## 注册器
13+
14+
### 定义
15+
16+
定义了一个注册器`Registry`,其继承自`dict`
17+
18+
* `py/ssd/utils/registry.py`
19+
20+
新增了一个`registry()`函数,用于保存模块名和对应的模块对象
21+
22+
### 声明
23+
24+
`py/ssd/models/registry.py`中新建了`3``Registry`对象,分别保存`BACKBONE、BOX_HEAD、BOX_PREDICTOR`
25+
26+
### 注册
27+
28+
使用装饰器的方式注册相应的模块,比如
29+
30+
* `py/ssd/models/backbone/vgg.py`
31+
* `py/ssd/models/box_head/box_head.py`
32+
* `py/ssd/models/box_head/box_predictor.py`
33+
34+
### 使用
35+
36+
每个`Registry`对象都是一个`dict`,根据配置文件输入相应的键和对应函数的参数即可
37+
38+
* `py/ssd/models/backbone/build.py`
39+
* `py/ssd/moels/box_head/build.py`

docs/model/loss/index.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
# 损失函数
3+
4+
对于目标检测算法而言,损失函数通常包含了`2`部分
5+
6+
1. 定位损失
7+
2. 置信度损失

docs/ssd/base_network.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
2+
# 基础网络
3+
4+
使用`VGG16`作为基础网络进行特征提取。关于`VGG16`实现细节参考[用于大尺度图像分类的极深卷积网络](https://blog.zhujian.life/posts/2738b55.html)
5+
6+
![](./imgs/vggnet.png)
7+
8+
**使用`VGG16-D`作为基础网络**
9+
10+
### 论文内容
11+
12+
* `3. Experimental Results`
13+
* `3.1 PASCAL VOC2007`
14+
15+
## 网络调整
16+
17+
![](./imgs/figure-2.png)
18+
19+
`5`个卷积模块保持不变
20+
21+
```
22+
[64, 64, 'M', 128, 128, 'M', 256, 256, 256, 'C', 512, 512, 512, 'M', 512, 512, 512],
23+
```
24+
25+
后续修改如下:
26+
27+
* 将最后一个池化层(`pool5`)从$2\times 2-s2$修改为$3\times 3-s1$
28+
* 将第一个和第二个全连接层(`fc6``fc7`)修改为卷积操作
29+
* `Conv6`:$3\times 3\times 1024, S=2$
30+
* `Conv7`:$1\times 1\times 1024$
31+
* 取消最后一个全连接层(`fc8`)和所有的随机失活操作
32+
*`Conv7`之后添加`4`个卷积模块
33+
* `Conv8`:先执行$1\times 1\times 256$,再执行$3\times 3\times 512 - s2$
34+
* `Conv9`:先执行$1\times 1\times 128$,再执行$3\times 3\times 256-s2$
35+
* `Conv10`:先执行$1\times 1\times 128$,再执行$3\times 3\times 256-s1$
36+
* `Conv11`:先执行$1\times 1\times 128$,再执行$3\times 3\times 256-s1$
37+
38+
## 特征层
39+
40+
分别取以下网络层作为特征层:
41+
42+
* `conv4_3`:$38\times 38\times 512$
43+
* `conv7(fc7)`:$19\times 19\times 1024$
44+
* `conv8_2`:$10\times 10\times 512$
45+
* `conv9_2`:$5\times 5\times 256$
46+
* `conv10_2`:$3\times 3\times 256$
47+
* `conv11_2`:$1\times 1\times 256$
48+
49+
## 具体实现
50+
51+
* `py/ssd/models/backbone/vgg.py`
52+
53+
添加了以下实现
54+
55+
1.`Conv4_3`特征层,额外进行了`L2 Norm`操作
56+
2.`Conv6`,使用了空洞卷积

docs/ssd/imgs/figure-2.png

207 KB
Loading

docs/ssd/imgs/vggnet.png

111 KB
Loading

docs/ssd/index.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
# SSD
3+
4+
[SSD(Single Shot MultiBox Detector)](https://arxiv.org/abs/1512.02325)是一个`One-Stage`目标检测算法。其相对于之前的检查算法(`YOLOv1、Faster RCNN`)而言,关键的区别在于
5+
6+
1. 使用多个**不同尺度**的特征图进行边界框预测
7+
2. 定义了一组**多个尺度、多个长宽比**的先验框
8+
2. 利用**小卷积滤波器**计算特征图,以得到先验框偏移和分类成绩
9+
10+
## 检测流程
11+
12+
1. 输入图像
13+
2. 通过卷积网络模型计算生成一组边界框偏移,以及和每个边界框对应的分类概率
14+
3. 结合先验框得到预测边界框
15+
4. 通过非最大抑制策略消除重叠的边界框
16+
5. 输出检测结果
17+
18+
## 训练流程
19+
20+
1. 加载训练数据
21+
2. 定义网络模型
22+
3. 定义损失函数
23+
4. 定义优化器
24+
5. 批量训练
25+
26+
下面操作中,默认定义
27+
28+
* 输入图像尺寸为$300\times 300$
29+
* 数据集为`PASCAL VOC`
30+
31+
最后再进一步扩充到$500\times 500$的场景

docs/ssd/prior_boxes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
# 先验框
3+

mkdocs.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,12 @@ nav:
5757
- 数据集加载: data/datasets/dataset_load.md
5858
- 数据集评估: data/datasets/dataset_eval.md
5959
- 检查点读写: data/checkpoint.md
60+
- 检测器模块:
61+
- 引言: model/index.md
6062
- 优化器模块:
6163
- 引言: optim/index.md
6264
- 梯度更新: optim/gradient_update.md
6365
- 学习率调度: optim/lr_scheduler.md
64-
# - SSD算法:
66+
- SSD算法:
67+
- 引言: ssd/index.md
68+
- 基础网络: ssd/base_network.md

0 commit comments

Comments
 (0)