zoukankan      html  css  js  c++  java
  • hard-negative mining 及伪代码实现

    Histogram of Oriented Gradients and Object Detection

    • 获得 records

      对于目标检测(object detection)问题,所谓的 hard-negative mining 针对的是训练集中的 negative training set(对于目标检测问题就是图像中非不存在目标的样本集合),对该负样本集中的每一副图像(的每一个可能的尺度),应用滑窗(sliding window)技术。对每次滑窗捕获的图像区域,计算该区域的 HOG 描述子,并作为分类器的输入。

      如果预定义的分类器将其错误地在其中检测出对象,也即 FP(false-positive,伪正),记录该 FP patch 对应的特征向量及分类器给出的概率。

      negative_training = ...
      clf = ...
      
      num_negative_training = len(negative_training)
      
      records = []
      
      for i in range(num_negative_training),
          for window in obtainSlideWindows(negative_training):
              hog = calcHOG(window)
              prob = clf.predict(hog)
              if prob > .5:
                  records.append((hog, prob))
    • 重新训练 retrain

      获得了伪正样本及其对应的概率值之后,又该如何处理这些 records 呢。根据概率值排序,再使用排序后对应的特征向量重新训练分类器:

      records = sorted(records, key=lambda r: r[1], reverse=True)
      for hog, prob in records:
          clf.train(hog)
    • 迭代以上两个过程

  • 相关阅读:
    Python开发【第二十一篇】:Web框架之Django【基础】
    梳理
    Python Day15 jQuery
    day12 html基础
    Python day11 Mysql
    锻炼马甲线
    第一章:软件性能测试基本概念
    第4关—input()函数
    第3关—条件判断与嵌套
    第2关—数据类型与转换
  • 原文地址:https://www.cnblogs.com/mtcnn/p/9421531.html
Copyright © 2011-2022 走看看