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)
    • 迭代以上两个过程

  • 相关阅读:
    centos7 安装mysql
    Nginx安装及配置详解
    nginx安装
    JSON Web Token
    优先队列
    小程序遮罩层禁止页面滚动(遮罩层内部可以滚动)
    H5中接入微信支付
    如何使用less预编译
    在methods中使用filter
    根据当前时间获取上一个月的时间
  • 原文地址:https://www.cnblogs.com/mtcnn/p/9421532.html
Copyright © 2011-2022 走看看