對於hard negative mining的解釋,引用一波知乎:git
先要理解什麼是hard negativegithub
R-CNN關於hard negative mining的部分引用了兩篇論文:bootstrap
[17] P. Felzenszwalb, R. Girshick, D. McAllester, and D. Ramanan. Object detection with discriminatively trained part based models. TPAMI, 2010.markdown
[37] K. Sung and T. Poggio. Example-based learning for viewbased human face detection. Technical Report A.I. Memo No. 1521, Massachussets Institute of Technology, 1994. 4app
Bootstrapping methods train a model with an initial subset of negative examples, and then collect negative examples that are incorrectly classified by this initial model to form a set of hard negatives. A new model is trained with the hard negative examples, and the process may be repeated a few times.
we use the following 「bootstrap」 strategy that incrementally selects only those 「nonface」 patterns with high utility value:
1) Start with a small set of 「nonface」 examples in the training database.
2) Train the MLP classifier with the current database of examples.
3) Run the face detector on a sequence of random images. Collect all the 「nonface」 patterns that the current system wrongly classifies as 「faces」 (see Fig. 5b).Add these 「nonface」 patterns to the training database as new negative examples.
4) Return to Step 2.
在bootstrapping方法中,咱們先用初始的正負樣本(通常是正樣本+與正樣本同規模的負樣本的一個子集)訓練分類器,而後再用訓練出的分類器對樣本進行分類,把其中錯誤分類的那些樣本(hard negative)放入負樣本集合,再繼續訓練分類器,如此反覆,直到達到中止條件(好比分類器性能再也不提高).dom
we expect these new examples to help steer the classifier away from its current mistakes.
hard negative就是每次把那些頑固的棘手的錯誤,再送回去繼續練,練到你的成績再也不提高爲止.這一個過程就叫作'hard negative mining'.ide
「Let’s say I give you a bunch of images that contain one or more people, and I give you bounding boxes for each one. Your classifier will need both positive training examples (person) and negative training examples (not person). 函數
For each person, you create a positive training example by looking inside that bounding box. But how do you create useful negative examples?
A good way to start is to generate a bunch of random bounding boxes, and for each that doesn’t overlap with any of your positives, keep that new box as a negative.
Ok, so you have positives and negatives, so you train a classifier, and to test it out, you run it on your training images again with a sliding window. But it turns out that your classifier isn’t very good, because it throws a bunch of false positives (people detected where there aren’t actually people).
A hard negative is when you take that falsely detected patch, and explicitly create a negative example out of that patch, and add that negative to your training set. When you retrain your classifier, it should perform better with this extra knowledge, and not make as many false positives.post
a) Positive samples: apply the existing detection a t all positions and scales with a 50% overlap wit h the given bounding box and then select the hi ghest scoring placement.
b) Negative samples:性能
hard negative, selected by finding high scoring detections in images not containing the target object.」
R-CNN的實現直接看代碼:
rcnn/rcnn_train.m at master · rbgirshick/rcnn Line:214開始的函數定義