zoukankan      html  css  js  c++  java
  • 目标检测:SSD的数据增强算法

    目标检测:SSD的数据增强算法

                        版权声明:本文为博主原创文章,未经博主允许不得转载。                        https://blog.csdn.net/zbzb1000/article/details/81037852                    </div>
                                                    <link rel="stylesheet" href="https://csdnimg.cn/release/phoenix/template/css/ck_htmledit_views-cd6c485e8b.css">
                                        <div id="content_views" class="markdown_views">
                    <!-- flowchart 箭头图标 勿删 -->
                    <svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
                        <path stroke-linecap="round" d="M5,0 0,2.5 5,5z" id="raphael-marker-block" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);"></path>
                    </svg>
                                            <h1 id="ssd的数据增强算法"><a name="t0"></a>SSD的数据增强算法</h1>
    

    代码地址

    https://github.com/weiliu89/caffe/tree/ssd

    论文地址

    https://arxiv.org/abs/1512.02325

    数据增强:

    图左是expand方法

    SSD数据增强有两种新方法:(1)expand ,左图(2)batch_sampler,右图

    expand_param {
          prob: 0.5 //expand发生的概率
          max_expand_ratio: 4 //expand的扩大倍数
        }
    • 1
    • 2
    • 3
    • 4

    expand是指对图像进行缩小,图像的其余区域补0,下图是expand的方法。个人认为这样做的目的是在数据处理阶段增加多尺度的信息。大object通过expand方法的处理可以变成小尺度的物体训练。提高ssd对尺度的泛化性。

    这里写图片描述

    annotated_data_param {//以下有7个batch_sampler
        batch_sampler {
          max_sample: 1
          max_trials: 1
        }
        batch_sampler {
          sampler {
            min_scale: 0.3
            max_scale: 1
            min_aspect_ratio: 0.5
            max_aspect_ratio: 2
          }
          sample_constraint {
            min_jaccard_overlap: 0.1
          }
          max_sample: 1
          max_trials: 50
        }
        batch_sampler {
          sampler {
            min_scale: 0.3
            max_scale: 1
            min_aspect_ratio: 0.5
            max_aspect_ratio: 2
          }
          sample_constraint {
            min_jaccard_overlap: 0.3
          }
          max_sample: 1
          max_trials: 50
        }
        batch_sampler {
          sampler {
            min_scale: 0.3
            max_scale: 1
            min_aspect_ratio: 0.5
            max_aspect_ratio: 2
          }
          sample_constraint {
            min_jaccard_overlap: 0.5
          }
          max_sample: 1
          max_trials: 50
        }
        batch_sampler {
          sampler {
            min_scale: 0.3
            max_scale: 1
            min_aspect_ratio: 0.5
            max_aspect_ratio: 2
          }
          sample_constraint {
            min_jaccard_overlap: 0.7
          }
          max_sample: 1
          max_trials: 50
        }
        batch_sampler {
          sampler {
            min_scale: 0.3
            max_scale: 1
            min_aspect_ratio: 0.5
            max_aspect_ratio: 2
          }
          sample_constraint {
            min_jaccard_overlap: 0.9
          }
          max_sample: 1
          max_trials: 50
        }
        batch_sampler {
          sampler {
            min_scale: 0.3
            max_scale: 1
            min_aspect_ratio: 0.5
            max_aspect_ratio: 2
          }
          sample_constraint {
            max_jaccard_overlap: 1
          }
          max_sample: 1
          max_trials: 50
        }
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83

    batch_sampler是对图像选取一个满足限制条件的区域(注意这个区域是随机抓取的)。限制条件就是抓取的patch和GT(Ground Truth)的IOU的值。

    步骤是:先在区间[min_scale,max_sacle]内随机生成一个值,这个值作为patch的高Height,然后在[min_aspect_ratio,max_aspect_ratio]范围内生成ratio,从而得到patch的Width。到此为止patch的宽和高随机得到,然后在图像中进行一次patch,要求满足与GT的最小IOU是0.9,也就是IOU>=0.9。如果随机patch满足这个条件,那么张图会被resize到300*300(在SSD300*300中)送进网络训练。如下图。

        batch_sampler {
          sampler {
            min_scale: 0.3
            max_scale: 1
            min_aspect_ratio: 0.5
            max_aspect_ratio: 2
          }
          sample_constraint {
            min_jaccard_overlap: 0.9
          }
          max_sample: 1
          max_trials: 50
        }
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13

    这里写图片描述

    上面的内容是通过jupyter notebook可视化得到的。并没有详细看SSD的transform_data的代码。如果有错误的地方,希望大家在评论处批评指正。

  • 相关阅读:
    单片机多功能调试助手
    《划时代51单片机C语言全新教程》第十九章 网络通信 概览
    《划时代51单片机C语言全新教程》第十五章 按键计数器 概览
    《划时代51单片机C语言全新教程》第十七章 频率计 概览
    前后台程序框架实例2
    《划时代51单片机C语言全新教程》第二十一章 深入编程 概览
    《划时代51单片机C语言全新教程》第二十二章 界面开发 概览
    《划时代51单片机C语言全新教程》第十八章 USB通信 概览
    《划时代51单片机C语言全新教程》第二十章 深入接口 概览
    《划时代51单片机C语言全新教程》第十六章 交通灯 概览
  • 原文地址:https://www.cnblogs.com/SanguineBoy/p/11209864.html
Copyright © 2011-2022 走看看