title: Eliminating false positives detected by an OpenCV face classifier
body: <p>I am working with thermal videos. My project determines in real-time whether each frame contains a face or not. By "contains a face", I mean this:</p>
  
  <p><a href="https://i.stack.imgur.com/Vthnk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Vthnk.png" alt="enter image description here"></a></p>
  
  <p>(<em>one face, this size and angle, per frame</em>)</p>
  
  <p>I've trained an LBP cascade classifier for this purpose. The classifier performs pretty well and is able to detect thermal faces with very low chance of false negative as shown above. However, the rate of false positives is quite alarming. Non-face objects in the void are detected, as shown below.</p>
  
  <p><a href="https://i.stack.imgur.com/Vthnk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rDSfr.png" alt="enter image description here"></a> <a href="https://i.stack.imgur.com/HMTSv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HMTSv.png" alt="enter image description here"></a> 
  <a href="https://i.stack.imgur.com/fee0Y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fee0Y.png" alt="enter image description here"></a></p>
  
  <p><em>Note: these images were used as negative samples</em></p>
  
  <p>By adjusting parameters of <code>detectMultiScale</code> method, the number of false positives can be reduced. But still, with a <code>scaleFactor</code> of 1.5 and <code>minNeighbors</code> of 10, I get false positives 20% of the time.</p>
  
  <p>For the cascade training I had 600 negative images (60x80) and 90 positive images (60x50), out of which 1200 positive samples were generated.</p>
  
  <p>So what are other possible solutions or work-around for this problem, without compromising speed of detection or frame rate?</p>
  
  <p><strong>EDIT:</strong> I have tried extracting hard negatives from my samples by using the trained classifier on the negative images and marking up the false negatives to include them in the next training. So far, I have been able to reduce the false positives to about 12%.  However i am still not satisfied with this result.</p>