<p><strong>I've revisited this topic recently in my work and thought I'd update with my current learnings for any who visit in the future.</strong></p>

<p>The topic appeared on <a href="https://github.com/tensorflow/models/issues/2544" rel="noreferrer">Tensorflow's Models repo issue tracker</a>. SSD allows you to set the ratio of how many negative:postive examples to mine (<code>max_negatives_per_positive: 3</code>), but you can also set a minimum number for images with no postives (<code>min_negatives_per_image: 3</code>). Both of these are defined in the model-ssd-loss config section. </p>

<p>That said, I don't see the same option in Faster-RCNN's model configuration. It's mentioned in the issue that <code>models/research/object_detection/core/balanced_positive_negative_sampler.py</code> contains the code used for Faster-RCNN.</p>

<p>One other option discussed in the issue is creating a second class specifically for lookalikes. During training, the model will attempt to learn class differences which should help serve your purpose.</p>

<p>Lastly, I came across this <a href="https://arxiv.org/pdf/1802.07845.pdf" rel="noreferrer">article</a> on Filter Amplifier Networks (FAN) that may be informative for your work on aerial imagery.</p>

<p>===================================================================</p>

<p>The following paper describes hard negative mining for the same purpose you describe:
<a href="https://arxiv.org/abs/1604.03540" rel="noreferrer">Training Region-based Object Detectors with Online Hard Example Mining</a></p>

<p>In section 3.1 they describe using a foreground and background class:</p>

<blockquote>
  <p>Background RoIs. A region is labeled background (bg) if its maximum
  IoU with ground truth is in the interval [bg lo, 0.5). A lower
  threshold of bg lo = 0.1 is used by both FRCN and SPPnet, and is
  hypothesized in [14] to crudely approximate hard negative mining; the
  assumption is that regions with some overlap with the ground truth are
  more likely to be the confusing or hard ones. We show in Section 5.4
  that although this heuristic helps convergence and detection accuracy,
  it is suboptimal because it ignores some infrequent, but important,
  difficult background regions. Our method removes the bg lo threshold.</p>
</blockquote>

<p>In fact this paper is referenced and its ideas are used in Tensorflow's object detection losses.py code for hard mining:</p>

<pre><code>class HardExampleMiner(object):
"""Hard example mining for regions in a list of images.
Implements hard example mining to select a subset of regions to be
back-propagated. For each image, selects the regions with highest losses,
subject to the condition that a newly selected region cannot have
an IOU &gt; iou_threshold with any of the previously selected regions.
This can be achieved by re-using a greedy non-maximum suppression algorithm.
A constraint on the number of negatives mined per positive region can also be
enforced.
Reference papers: "Training Region-based Object Detectors with Online
Hard Example Mining" (CVPR 2016) by Srivastava et al., and
"SSD: Single Shot MultiBox Detector" (ECCV 2016) by Liu et al.
"""
</code></pre>

<p>Based on your model config file, the HardMinerObject is returned by losses_builder.py in this bit of code:</p>

<pre><code>def build_hard_example_miner(config,
                            classification_weight,
                            localization_weight):
"""Builds hard example miner based on the config.
Args:
    config: A losses_pb2.HardExampleMiner object.
    classification_weight: Classification loss weight.
    localization_weight: Localization loss weight.
Returns:
    Hard example miner.
"""
loss_type = None
if config.loss_type == losses_pb2.HardExampleMiner.BOTH:
    loss_type = 'both'
if config.loss_type == losses_pb2.HardExampleMiner.CLASSIFICATION:
    loss_type = 'cls'
if config.loss_type == losses_pb2.HardExampleMiner.LOCALIZATION:
    loss_type = 'loc'

max_negatives_per_positive = None
num_hard_examples = None
if config.max_negatives_per_positive &gt; 0:
    max_negatives_per_positive = config.max_negatives_per_positive
if config.num_hard_examples &gt; 0:
    num_hard_examples = config.num_hard_examples
hard_example_miner = losses.HardExampleMiner(
    num_hard_examples=num_hard_examples,
    iou_threshold=config.iou_threshold,
    loss_type=loss_type,
    cls_loss_weight=classification_weight,
    loc_loss_weight=localization_weight,
    max_negatives_per_positive=max_negatives_per_positive,
    min_negatives_per_image=config.min_negatives_per_image)
return hard_example_miner
</code></pre>

<p>which is returned by model_builder.py and called by train.py. So basically, it seems to me that simply generating your true positive labels (with a tool like LabelImg or RectLabel) should be enough for the train algorithm to find hard negatives within the same images. The related question gives an excellent <a href="https://stackoverflow.com/questions/44973184/train-tensorflow-object-detection-on-own-dataset">walkthrough</a>.</p>

<p>In the event you want to feed in data that has no true positives (i.e. nothing should be classified in the image), just add the negative image to your tfrecord with no bounding boxes. </p>
Best strategy to reduce false positives: Google's new Object Detection API on Satellite Imagery
<p>I'm setting up the new <a href="https://github.com/tensorflow/models/tree/master/research/object_detection" rel="noreferrer">Tensorflow Object Detection API</a> to find small objects in large areas of satellite imagery. It works quite well - it finds all 10 objects I want, but I also get 50-100 false positives [things that look a little like the target object, but aren't].</p>

<p>I'm using the <a href="https://github.com/tensorflow/models/blob/master/research/object_detection/samples/configs/faster_rcnn_resnet101_pets.config" rel="noreferrer">sample config</a> from the <a href="https://cloud.google.com/blog/big-data/2017/06/training-an-object-detector-using-cloud-machine-learning-engine" rel="noreferrer">'pets' tutorial</a>, to fine-tune the <code>faster_rcnn_resnet101_coco</code> model they offer. I've started small, with only 100 training examples of my objects (just 1 class). 50 examples in my validation set. Each example is a 200x200 pixel image with a labeled object (~40x40) in the center. I train until my precision &amp; loss curves plateau.</p>

<p>I'm relatively new to using deep learning for object detection. What is the best strategy to increase my precision? e.g. Hard-negative mining? Increase my training dataset size? I've yet to try the most accurate model they offer <code>faster_rcnn_inception_resnet_v2_atrous_coco</code> as i'd like to maintain some speed, but will do so if needed.</p>

<p>Hard-negative mining seems to be a logical step. If you agree, how do I implement it w.r.t setting up the tfrecord file for my training dataset? Let's say I make 200x200 images for each of the 50-100 false positives:</p>

<ul>
<li>Do I create 'annotation' xml files for each, with no 'object' element?</li>
<li>...or do I label these hard negatives as a second class?</li>
<li>If I then have 100 negatives to 100 positives in my training set - is that a healthy ratio? How many negatives can I include?</li>
</ul>