YOLO包括 V1, V2, V3

YOLO v1:2016

优点:快,45fps,泛化性能好

缺点:检测小物体不太行, 如成群的鸟. 与 Fast R-CNN相比,定位不太准

  • YOLO的网络结构

YOLO v1 network (没看懂论文上的下图,看下面这个表一目了然了)

24层的卷积层,开始用前面20层来training, 图片是224x224的,然后用448x448 再train 后面4层,最后得到的model 是24层的model.

最后输出7x7个grid cell, 30 表示 2个bounding box (每个5个数字) 加上 20 classes

  

┌────────────┬────────────────────────┬───────────────────┐
│ Name │ Filters │ Output Dimension │
├────────────┼────────────────────────┼───────────────────┤
│ Conv 1 │ 7 x 7 x 64, stride=2 │ 224 x 224 x 64 │
│ Max Pool 1 │ 2 x 2, stride=2 │ 112 x 112 x 64 │
│ Conv 2 │ 3 x 3 x 192 │ 112 x 112 x 192 │
│ Max Pool 2 │ 2 x 2, stride=2 │ 56 x 56 x 192 │
│ Conv 3 │ 1 x 1 x 128 │ 56 x 56 x 128 │
│ Conv 4 │ 3 x 3 x 256 │ 56 x 56 x 256 │
│ Conv 5 │ 1 x 1 x 256 │ 56 x 56 x 256 │
│ Conv 6 │ 1 x 1 x 512 │ 56 x 56 x 512 │
│ Max Pool 3 │ 2 x 2, stride=2 │ 28 x 28 x 512 │
│ Conv 7 │ 1 x 1 x 256 │ 28 x 28 x 256 │
│ Conv 8 │ 3 x 3 x 512 │ 28 x 28 x 512 │
│ Conv 9 │ 1 x 1 x 256 │ 28 x 28 x 256 │
│ Conv 10 │ 3 x 3 x 512 │ 28 x 28 x 512 │
│ Conv 11 │ 1 x 1 x 256 │ 28 x 28 x 256 │
│ Conv 12 │ 3 x 3 x 512 │ 28 x 28 x 512 │
│ Conv 13 │ 1 x 1 x 256 │ 28 x 28 x 256 │
│ Conv 14 │ 3 x 3 x 512 │ 28 x 28 x 512 │
│ Conv 15 │ 1 x 1 x 512 │ 28 x 28 x 512 │
│ Conv 16 │ 3 x 3 x 1024 │ 28 x 28 x 1024 │
│ Max Pool 4 │ 2 x 2, stride=2 │ 14 x 14 x 1024 │
│ Conv 17 │ 1 x 1 x 512 │ 14 x 14 x 512 │
│ Conv 18 │ 3 x 3 x 1024 │ 14 x 14 x 1024 │
│ Conv 19 │ 1 x 1 x 512 │ 14 x 14 x 512 │
│ Conv 20 │ 3 x 3 x 1024 │ 14 x 14 x 1024 │
│ Conv 21 │ 3 x 3 x 1024 │ 14 x 14 x 1024 │
│ Conv 22 │ 3 x 3 x 1024, stride=2 │ 7 x 7 x 1024 │
│ Conv 23 │ 3 x 3 x 1024 │ 7 x 7 x 1024 │
│ Conv 24 │ 3 x 3 x 1024 │ 7 x 7 x 1024 │
│ FC 1 │ - │ 4096 │
│ FC 2 │ - │ 7 x 7 x 30 (1470) │
└────────────┴────────────────────────┴───────────────────┘ 上图中,至于为什么448x448通过conv成了224x224, 可以参考这里 https://blog.csdn.net/caomin1hao/article/details/80601255,因为一般会做zero-padding, padding = (f-1)/2

预训练的时候用 224x224 的图片,预测时用的448x448的,但是网络结构没有任何变化,只是输出按照比例缩小,比如本来检测网络第20层输出 14 x 14 x 1024 维度,预训练时输出的就是 7x7x1024. 参考的这里 https://blog.csdn.net/qq_30666517/article/details/80572659

  • v1 两个bounding box 怎么标注?

这里采用2个bounding box,有点不完全算监督算法,而是像进化算法。如果是监督算法,我们需要事先根据样本就能给出一个正确的bounding box作为回归的目标。但YOLO的2个bounding box事先并不知道会在什么位置,只有经过前向计算,网络会输出2个bounding box,这两个bounding box与样本中对象实际的bounding box计算IOU。这时才能确定,IOU值大的那个bounding box,作为负责预测该对象的bounding box。

训练开始阶段,网络预测的bounding box可能都是乱来的,但总是选择IOU相对好一些的那个,随着训练的进行,每个bounding box会逐渐擅长对某些情况的预测(可能是对象大小、宽高比、不同类型的对象等)。所以,这是一种进化或者非监督学习的思想。
训练样本的bounding box位置应该填写对象实际的bounding box,但一个对象对应了2个bounding box,该填哪一个呢?上面讨论过,需要根据网络输出的bounding box与对象实际bounding box的IOU来选择,所以要在训练过程中动态决定到底填哪一个bounding box。
 
 
 

YOLO v2 (YOLO9000):2016

Yolo v2 的网络结构如下:采用 Darknet-19 backbone, 输出 13x13x (5x25). 引入了 anchor box.
由于v2 去掉了fully connected layer, 这样可以对各种size 的输入进行traning, 这个技术叫 multi-scale traning, input size 的大小为 {320, 352, ..., 608}
  

Darknet-19 分类模型:

Darknet-19 对象检测模型:

看一下passthrough层。图中第25层route 16,意思是来自16层的output,即26*26*512,这是passthrough层的来源(细粒度特征)。第26层1*1卷积降低通道数,从512降低到64(这一点论文在讨论passthrough的时候没有提到),输出26*26*64。第27层进行拆分(passthrough层)操作,1拆4分成13*13*256。第28层叠加27层和24层的输出,得到13*13*1280。后面再经过3*3卷积和1*1卷积,最后输出13*13*125。
  • 为什么v2 比v1 运行更快,效果更好

faster: 采用了浮点运算更快的darknet-19结构, v1 的运算操作是8.52 billion operations, v2 是only requires 5.58 billion.

better: 采用了 BatchNorm的同时去掉了dropout 层, 采用 了high resolution classifier, K-means自动选取anchor box, multi-scale 训练使得能检测多种不同大小的对象
stronger: 采用了 wordTree的概念来预测超过9000中的对象 (9418)
  • v2 的训练过程

YOLO2的训练主要包括三个阶段。第一阶段就是先在ImageNet分类数据集上预训练Darknet-19,此时模型输入为 224*224 ,共训练160个epochs。然后第二阶段将网络的输入调整为 448*448 ,继续在ImageNet数据集上finetune分类模型,训练10个epochs,此时分类模型的top-1准确度为76.5%,而top-5准确度为93.3%。第三个阶段就是修改Darknet-19分类模型为检测模型,移除最后一个卷积层、global avgpooling层以及softmax层,并且新增了三个 3*3*1024卷积层,同时增加了一个passthrough层,最后使用 1*1 卷积层输出预测结果,输出的channels数为:num_anchors*(5+num_classes) ,和训练采用的数据集有关系。由于anchors数为5,对于VOC数据集(20种分类对象)输出的channels数就是125,最终的预测矩阵T的shape为 (batch_size, 13, 13, 125),可以先将其reshape为 (batch_size, 13, 13, 5, 25) ,其中 T[:, :, :, :, 0:4] 为边界框的位置和大小  ,T[:, :, :, :, 4] 为边界框的置信度,而 T[:, :, :, :, 5:] 为类别预测值。

YOLO9000依然采用YOLO2的网络结构,不过5个先验框减少到3个先验框,以减少计算量。YOLO2的输出是13*13*5*(4+1+20),现在YOLO9000的输出是13*13*3*(4+1+9418)。假设输入是416*416*3。

YOLO v3 (2018)



V3 检测网络结构:106层


                         
 
Ref:
  1. YOLO v1深入理解 (v1里面有两个bounding box, 那标注时候到底填哪一个呢?这个文章解释了这个)
  2. YOLOv1阅读笔记, 这个对yolo v1 的网络结构解释的不错
  3. 目标检测网络之 YOLOv3
  4. Understanding YOLO
  5. <机器爱学习>YOLOv2 / YOLO9000 深入理解
  6. yolo类检测算法解析——yolo v3
  7. 目标检测(九)--YOLO v1,v2,v3
  8. What’s new in YOLO v3?
  9. https://blog.csdn.net/qq_34784753/article/details/78797213,https://zhuanlan.zhihu.com/p/24916786?utm_source=qq&utm_medium=social,  这个对yolo v1 的cost函数解释的不错
  10. YOLOv3 深入理解

理解 YOLO的更多相关文章

  1. Pytorch从0开始实现YOLO V3指南 part1——理解YOLO的工作

    本教程翻译自https://blog.paperspace.com/how-to-implement-a-yolo-object-detector-in-pytorch/ 视频展示:https://w ...

  2. 快速理解YOLO目标检测

    YOLO(You Only Look Once)论文 近些年,R-CNN等基于深度学习目标检测方法,大大提高了检测精度和检测速度. 例如在Pascal VOC数据集上Faster R-CNN的mAP达 ...

  3. YOLO理解

    一.YOLO v1 1.网络结构 (1)最后一层使用线性激活函数: (2)其他各层使用leaky ReLU的激活函数: 2.Training (1) 将原图划分为SxS的网格.如果一个目标的中心落入某 ...

  4. 第三十五节,目标检测之YOLO算法详解

    Redmon, J., Divvala, S., Girshick, R., Farhadi, A.: You only look once: Unified, real-time object de ...

  5. YOLO V2 代码分析

    先介绍YOLO[转]: 第一个颠覆ross的RCNN系列,提出region-free,把检测任务直接转换为回归来做,第一次做到精度可以,且实时性很好. 1. 直接将原图划分为SxS个grid cell ...

  6. 深度剖析YOLO系列的原理

    深度剖析YOLO系列的原理 本文系作者原创,转载请注明出处:https://www.cnblogs.com/further-further-further/p/12072225.html 目录 1. ...

  7. 【目标检测】YOLO:

    PPT 可以说是讲得相当之清楚了... deepsystems.io 中文翻译: https://zhuanlan.zhihu.com/p/24916786 图解YOLO YOLO核心思想:从R-CN ...

  8. YOLO: You Only Look Once论文阅读摘要

    论文链接: https://arxiv.org/pdf/1506.02640.pdf 代码下载: https://github.com/gliese581gg/YOLO_tensorflow Abst ...

  9. Yolo V3整体思路流程详解!

    结合开源项目tensorflow-yolov3(https://link.zhihu.com/?target=https%3A//github.com/YunYang1994/tensorflow-y ...

随机推荐

  1. PowerDesigner 提示 Existence of index、key、reference错误

    一.建立一个表后,为何检测出现Existence of index的警告 A table should contain at least one column, one index, one key, ...

  2. 网络流 P2770 航空路线问题

    #include <cstdio> #include <cstdlib> #include <map> #include <queue> #includ ...

  3. Neutron:Firewall as a Service(FWaaS)

    用户可以用它来创建和管理防火墙,在 subnet 的边界上对 layer 3 和 layer 4 的流量进行过滤.   传统网络中的防火墙一般放在网关上,用来控制子网之间的访问. FWaaS 的原理也 ...

  4. pytorch识别CIFAR10:训练ResNet-34(自定义transform,动态调整学习率,准确率提升到94.33%)

    版权声明:本文为博主原创文章,欢迎转载,并请注明出处.联系方式:460356155@qq.com 前面通过数据增强,ResNet-34残差网络识别CIFAR10,准确率达到了92.6. 这里对训练过程 ...

  5. Spring Bean's life

    In contrast, the lifecycle of a bean in a Spring container is more elaborate. It’simportant to under ...

  6. 通过VuePress管理项目文档(二)

    通过vue组件实现跟:Element相似的效果.需要在VuePress网站中将自己的项目中的Vue组件运行结果展示在页面中. 至于如何将组件在VuePress网站中展示请参考:https://segm ...

  7. Windows XP Services

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\

  8. Nginx CONTENT阶段 autoindex、index模块

    L 66 autoindex 指令 syntax : on | off; default : off; context : http,server,location; autoindex_exact_ ...

  9. bzoj 2157: 旅游 (LCT 边权)

    链接:https://www.lydsy.com/JudgeOnline/problem.php?id=2157 题面; 2157: 旅游 Time Limit: 10 Sec  Memory Lim ...

  10. promise和setTimeout执行顺序的问题

    提出问题,问题代码为 setTimeout(function(){console.log(1)},0); new Promise(function(resolve){ console.log(2) f ...