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中xlrd模块
    2021, 8, 26模拟赛
    2021, 8,24 模拟赛
    每天挂 0 的小技巧
    2021,8,23 模拟赛
    异常处理
    64位 windows10,MYSQL8.0.13重置密码(忘记密码或者无法登录)
    Android仓库
    学习笔记索引
    「学习笔记」各类容斥反演总结
  • 原文地址:https://www.cnblogs.com/mtcnn/p/9421531.html
Copyright © 2011-2022 走看看