docstr: Tests that we're choosing a foreground box when there's several for
  the same gt box.
docstr_tok: ["Tests","that","we","'re","choosing","a","foreground","box","when","there","'s","several","for","the","same","gt","box","."]
code: def testMultipleOverlap(self):
      """Tests that we're choosing a foreground box when there's several for
      the same gt box.
      """
  
      gt_boxes = tf.constant(
          [(200, 300, 250, 390, self._placeholder_label)],
          dtype=tf.float32,
      )
  
      proposed_boxes = tf.constant(
          [
              (12, 70, 350, 540),  # noise
              (190, 310, 240, 370),  # IoU: 0.4763
              (197, 300, 252, 389),  # IoU: 0.9015
              (196, 300, 252, 389),  # IoU: 0.8859
              (197, 303, 252, 394),  # IoU: 0.8459
              (180, 310, 235, 370),  # IoU: 0.3747
              (0, 0, 400, 400),  # noise
              (197, 302, 252, 389),  # IoU: 0.8832
              (0, 0, 400, 400),  # noise
          ],
          dtype=tf.float32,
      )
  
      proposals_label, bbox_targets = self._run_rcnn_target(
          self._shared_model, gt_boxes, proposed_boxes
      )
  
      # Assertions
      foreground_number = proposals_label[proposals_label >= 1].shape[0]
      background_number = proposals_label[proposals_label == 0].shape[0]
  
      foreground_fraction = self._config.foreground_fraction
  
      self.assertEqual(
          foreground_number,
          np.floor(self._config.minibatch_size * foreground_fraction),
      )
      self.assertEqual(
          background_number,
          self._config.minibatch_size - foreground_number,
      )
  
      foreground_idxs = np.nonzero(proposals_label >= 1)
      for foreground_idx in foreground_idxs:
          self.assertIn(foreground_idx, [2, 3, 4, 7])
  
      self.assertEqual(
          proposals_label[proposals_label >= 0].shape[0],
          self._config.minibatch_size,
      )
  
file_path: luminoth/luminoth/models/fasterrcnn/rcnn_target_test.py
imports: import numpy
  import tensorflow
  from easydict import EasyDict
  from luminoth.models.fasterrcnn.rcnn_target import RCNNTarget
  from luminoth.utils.test.gt_boxes import generate_gt_boxes
label_desc: Use image node_id 6 for calling the RCNNTargetTest obj's underlying member method code with example usage: obj.testMultipleOverlap() without return types