docstr: Test with anchors that fall partially outside the image.
docstr_tok: ["Test","with","anchors","that","fall","partially","outside","the","image","."]
code: def testBorderOutsiders(self):
      """
      Test with anchors that fall partially outside the image.
      """
      all_anchors = np.array(
          [
              [200, 100, 400, 400],  # foreground
              [300, 300, 400, 400],  # background
              [200, 380, 300, 500],  # background
              [500, 500, 600, 650],  # border outsider
              [200, 100, 400, 400],  # foreground
          ]
      )
  
      config = self.config
      config["minibatch_size"] = 5
      labels, bbox_targets, max_overlaps = self._run_rpn_target(
          all_anchors, self.gt_boxes, config
      )
  
      # Checks that the order of labels for anchors is correct.
      # The fourth anchor is always ignored because it has a point outside
      # the image.
      self.assertAllEqual(labels, np.array([1, 0, 0, -1, 1]))
  
      # Check that foreground bbox targets are partially zero because
      # the X1 and width are already the same
      self.assertEqual(bbox_targets[0][0], 0)
      self.assertEqual(bbox_targets[0][2], 0)
      self.assertNotEqual(bbox_targets[0][1], 0)
      self.assertNotEqual(bbox_targets[0][3], 0)
      self.assertAllEqual(bbox_targets[0], bbox_targets[-1])
  
      # Assert bbox targets we are ignoring are zero.
      self.assertAllEqual(bbox_targets[1:4], np.zeros((3, 4)))
  
      # Test with a different foreground_fraction value.
      config["foreground_fraction"] = 0.2
      labels, bbox_targets, max_overlaps = self._run_rpn_target(
          all_anchors, self.gt_boxes, config
      )
  
      # Checks that the order of labels for anchors is correct.
      # The fourth anchor is always ignored because it has a point outside
      # the image.
      self.assertAllEqual(labels, np.array([1, 0, 0, -1, -1]))
  
      # Assert bbox targets we are ignoring are zero.
      self.assertAllEqual(bbox_targets[1:], np.zeros((4, 4)))
  
file_path: luminoth/luminoth/models/fasterrcnn/rpn_target_test.py
imports: import numpy
  import tensorflow
  from easydict import EasyDict
  from luminoth.models.fasterrcnn.rpn_target import RPNTarget
label_desc: Use image node_id 4 for calling the RPNTargetTest obj's underlying member method code with example usage: obj.testBorderOutsiders() without return types