高斯-yolov3

在目标检测的落地项目中,实时性和精确性的trade-off至关重要,而YOLOv3是目前为止在这方面做得最好的算法。本文通过高斯分布的特性,改进YOLOv3使得网络能够输出每个检测框的不确定性,从而提升了网络的精度。

1.YOLOv3简介

如下图a所示,为YOLOv3的网络架构。
YOLOv3使用了skip shotcut的操作方式网络过深而引起的梯度消散。
YOLOv3使用了up-sample操作,并将大特征图和小特征图upsample后的特征图进行concat,使网络能够拥有既包含丰富的高层抽象特征和精确的位置信息特征的融合特征层。
YOLOv3使用了特征金字塔结构,使得网络能够在三个不同的尺度特征下做目标检测,能够适应与多种不同大小的目标检测任务。

如下图b所示,为利用YOLOv3进行目标检测时的网络输出。
RGB图像作为YOLOv3网络的输入,检测结果会在三个不同的尺度分别输出,包含了目标的坐标位置,目标是正样本还是负样本,目标属于那个类别的置信度,对于每个尺度的分支而言,会在每个grid中会预测出三个结果(因为每个尺度下会有三个anchor)。最终将三个尺度的结果合并,进行非极大值抑制(NMS)后,输出最终的检测结果。

正如YOLOv3的输出结果所述,目标类别是有概率值的,但目标框只有位置而没有概率值,也就是从结果中无法预知当前目标框的可靠性。基于此本文利用Guassian模型来对网络输出进行建模,在基本不改变YOLOv3结构和计算量的情况下,能够输出每个预测框的可靠性,并且在算法总体性能上提升了3个点的MAP。

2.Guassian YOLOv3介绍

如图所示,Guassian YOLOv3通过增加网络的输出,和改进网络的损失函数,实现了对预测框可靠性的输出。

  • 新的预测输出
    下图为源代码对比,从中我们可以看出,与原始的YOLOv3在坐标预测时输出4个维度不同,Guassian YOLOv3在bounding box的坐标预测输出中包含了8个维度。

    这八个维度相当于是预测框中心坐标和长宽,以及对应预测框的不确定性。作者将这些指建模为四个高斯分布,目标框的位置作为高斯分布的均值,对应的不确定性作为方差。如下图的比对代码所示,Gaussian YOLOv3通过预测每个坐标位置的不确定性,从而提升最终预测prob值的精确性。

  • 新的损失函数

由于Gaussian YOLOv3的输出进行了调整,与之对应的损失函数的计算也会做相应的调整。与原始的YOLOv3相比,仅仅调整了预测框坐标位置的回归策略。如下代码对比所示,原始的YOLOv3进行box回归时,由于网络预测输出就是坐标本身,因此计算梯度时就利用了均方误差的方式。而由于Gaussian YOLOv3输出的是均值和方差,因此在计算梯度时就结合了高斯分布的策略。

Gaussian YOLOv3的损失函数如下:

3. Gaussian YOLOv3结果比对

                                </div>
            <link href="https://csdnimg.cn/release/phoenix/mdeditor/markdown_views-b6c3c6d139.css" rel="stylesheet">
                                            <div class="more-toolbox">
            <div class="left-toolbox">
                <ul class="toolbox-list">
                    
                    <li class="tool-item tool-active is-like "><a href="javascript:;"><svg class="icon" aria-hidden="true">
                        <use xlink:href="#csdnc-thumbsup"></use>
                    </svg><span class="name">点赞</span>
                    <span class="count"></span>
                    </a></li>
                    <li class="tool-item tool-active is-collection "><a href="javascript:;" data-report-click="{&quot;mod&quot;:&quot;popu_824&quot;}"><svg class="icon" aria-hidden="true">
                        <use xlink:href="#icon-csdnc-Collection-G"></use>
                    </svg><span class="name">收藏</span></a></li>
                    <li class="tool-item tool-active is-share"><a href="javascript:;"><svg class="icon" aria-hidden="true">
                        <use xlink:href="#icon-csdnc-fenxiang"></use>
                    </svg>分享</a></li>
                    <!--打赏开始-->
                                            <!--打赏结束-->
                                            <li class="tool-item tool-more">
                        <a>
                        <svg t="1575545411852" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5717" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M179.176 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5718"></path><path d="M509.684 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5719"></path><path d="M846.175 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5720"></path></svg>
                        </a>
                        <ul class="more-box">
                            <li class="item"><a class="article-report">文章举报</a></li>
                        </ul>
                    </li>
                                        </ul>
            </div>
                        </div>
        <div class="person-messagebox">
            <div class="left-message"><a href="https://blog.csdn.net/qiu931110">
                <img src="https://profile.csdnimg.cn/F/2/F/3_qiu931110" class="avatar_pic" username="qiu931110">
                                        <img src="https://g.csdnimg.cn/static/user-reg-year/1x/5.png" class="user-years">
                                </a></div>
            <div class="middle-message">
                                    <div class="title"><span class="tit"><a href="https://blog.csdn.net/qiu931110" data-report-click="{&quot;mod&quot;:&quot;popu_379&quot;}" target="_blank">yuanCruise</a></span>
                                                <span class="flag expert">
                            <a href="https://blog.csdn.net/home/help.html#classicfication" target="_blank">
                                <svg class="icon" aria-hidden="true">
                                    <use xlink:href="#csdnc-blogexpert"></use>
                                </svg>
                                博客专家
                            </a>
                        </span>
                                        </div>
                <div class="text"><span>发布了234 篇原创文章</span> · <span>获赞 187</span> · <span>访问量 40万+</span></div>
            </div>
                            <div class="right-message">
                                        <a href="https://bbs.csdn.net/topics/395525744" target="_blank" class="btn btn-sm btn-red-hollow bt-button personal-messageboard">他的留言板
                    </a>
                                                        <a class="btn btn-sm  bt-button personal-watch" data-report-click="{&quot;mod&quot;:&quot;popu_379&quot;}">关注</a>
                                </div>
                        </div>
                </div>
发布了37 篇原创文章 · 获赞 12 · 访问量 2万+

在目标检测的落地项目中,实时性和精确性的trade-off至关重要,而YOLOv3是目前为止在这方面做得最好的算法。本文通过高斯分布的特性,改进YOLOv3使得网络能够输出每个检测框的不确定性,从而提升了网络的精度。

1.YOLOv3简介

如下图a所示,为YOLOv3的网络架构。
YOLOv3使用了skip shotcut的操作方式网络过深而引起的梯度消散。
YOLOv3使用了up-sample操作,并将大特征图和小特征图upsample后的特征图进行concat,使网络能够拥有既包含丰富的高层抽象特征和精确的位置信息特征的融合特征层。
YOLOv3使用了特征金字塔结构,使得网络能够在三个不同的尺度特征下做目标检测,能够适应与多种不同大小的目标检测任务。

如下图b所示,为利用YOLOv3进行目标检测时的网络输出。
RGB图像作为YOLOv3网络的输入,检测结果会在三个不同的尺度分别输出,包含了目标的坐标位置,目标是正样本还是负样本,目标属于那个类别的置信度,对于每个尺度的分支而言,会在每个grid中会预测出三个结果(因为每个尺度下会有三个anchor)。最终将三个尺度的结果合并,进行非极大值抑制(NMS)后,输出最终的检测结果。

正如YOLOv3的输出结果所述,目标类别是有概率值的,但目标框只有位置而没有概率值,也就是从结果中无法预知当前目标框的可靠性。基于此本文利用Guassian模型来对网络输出进行建模,在基本不改变YOLOv3结构和计算量的情况下,能够输出每个预测框的可靠性,并且在算法总体性能上提升了3个点的MAP。

2.Guassian YOLOv3介绍

如图所示,Guassian YOLOv3通过增加网络的输出,和改进网络的损失函数,实现了对预测框可靠性的输出。

  • 新的预测输出
    下图为源代码对比,从中我们可以看出,与原始的YOLOv3在坐标预测时输出4个维度不同,Guassian YOLOv3在bounding box的坐标预测输出中包含了8个维度。

    这八个维度相当于是预测框中心坐标和长宽,以及对应预测框的不确定性。作者将这些指建模为四个高斯分布,目标框的位置作为高斯分布的均值,对应的不确定性作为方差。如下图的比对代码所示,Gaussian YOLOv3通过预测每个坐标位置的不确定性,从而提升最终预测prob值的精确性。

  • 新的损失函数

由于Gaussian YOLOv3的输出进行了调整,与之对应的损失函数的计算也会做相应的调整。与原始的YOLOv3相比,仅仅调整了预测框坐标位置的回归策略。如下代码对比所示,原始的YOLOv3进行box回归时,由于网络预测输出就是坐标本身,因此计算梯度时就利用了均方误差的方式。而由于Gaussian YOLOv3输出的是均值和方差,因此在计算梯度时就结合了高斯分布的策略。

Gaussian YOLOv3的损失函数如下:

3. Gaussian YOLOv3结果比对

                                </div>
            <link href="https://csdnimg.cn/release/phoenix/mdeditor/markdown_views-b6c3c6d139.css" rel="stylesheet">
                                            <div class="more-toolbox">
            <div class="left-toolbox">
                <ul class="toolbox-list">
                    
                    <li class="tool-item tool-active is-like "><a href="javascript:;"><svg class="icon" aria-hidden="true">
                        <use xlink:href="#csdnc-thumbsup"></use>
                    </svg><span class="name">点赞</span>
                    <span class="count"></span>
                    </a></li>
                    <li class="tool-item tool-active is-collection "><a href="javascript:;" data-report-click="{&quot;mod&quot;:&quot;popu_824&quot;}"><svg class="icon" aria-hidden="true">
                        <use xlink:href="#icon-csdnc-Collection-G"></use>
                    </svg><span class="name">收藏</span></a></li>
                    <li class="tool-item tool-active is-share"><a href="javascript:;"><svg class="icon" aria-hidden="true">
                        <use xlink:href="#icon-csdnc-fenxiang"></use>
                    </svg>分享</a></li>
                    <!--打赏开始-->
                                            <!--打赏结束-->
                                            <li class="tool-item tool-more">
                        <a>
                        <svg t="1575545411852" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5717" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M179.176 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5718"></path><path d="M509.684 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5719"></path><path d="M846.175 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5720"></path></svg>
                        </a>
                        <ul class="more-box">
                            <li class="item"><a class="article-report">文章举报</a></li>
                        </ul>
                    </li>
                                        </ul>
            </div>
                        </div>
        <div class="person-messagebox">
            <div class="left-message"><a href="https://blog.csdn.net/qiu931110">
                <img src="https://profile.csdnimg.cn/F/2/F/3_qiu931110" class="avatar_pic" username="qiu931110">
                                        <img src="https://g.csdnimg.cn/static/user-reg-year/1x/5.png" class="user-years">
                                </a></div>
            <div class="middle-message">
                                    <div class="title"><span class="tit"><a href="https://blog.csdn.net/qiu931110" data-report-click="{&quot;mod&quot;:&quot;popu_379&quot;}" target="_blank">yuanCruise</a></span>
                                                <span class="flag expert">
                            <a href="https://blog.csdn.net/home/help.html#classicfication" target="_blank">
                                <svg class="icon" aria-hidden="true">
                                    <use xlink:href="#csdnc-blogexpert"></use>
                                </svg>
                                博客专家
                            </a>
                        </span>
                                        </div>
                <div class="text"><span>发布了234 篇原创文章</span> · <span>获赞 187</span> · <span>访问量 40万+</span></div>
            </div>
                            <div class="right-message">
                                        <a href="https://bbs.csdn.net/topics/395525744" target="_blank" class="btn btn-sm btn-red-hollow bt-button personal-messageboard">他的留言板
                    </a>
                                                        <a class="btn btn-sm  bt-button personal-watch" data-report-click="{&quot;mod&quot;:&quot;popu_379&quot;}">关注</a>
                                </div>
                        </div>
                </div>

猜你喜欢

转载自blog.csdn.net/weixin_43489950/article/details/104537183