docstr: Test clipping of proposals before and after NMS
docstr_tok: ["Test","clipping","of","proposals","before","and","after","NMS"]
code: def testFilterOutsideAnchors(self):
      """
      Test clipping of proposals before and after NMS
      """
      gt_boxes = np.array(
          [
              [0, 0, 10, 12],
              [10, 10, 20, 22],
              [10, 10, 20, 22],
              [30, 25, 39, 39],
              [30, 25, 39, 39],
          ]
      )
      all_anchors = np.array(
          [  # Img_size (40, 40)
              [-20, -10, 12, 6],  # Should be filtered
              [2, 10, 20, 20],  # Valid anchor
              [0, 0, 50, 16],  # Should be filtered
              [2, -10, 20, 50],  # Should be filtered
              [25, 30, 27, 33],  # Valid anchor
          ]
      )
      rpn_cls_prob = np.array(
          [
              [0.3, 0.7],
              [0.4, 0.6],
              [0.3, 0.7],
              [0.1, 0.9],
              [0.2, 0.8],
          ]
      )
      config = EasyDict(self.config)
      config["filter_outside_anchors"] = False
      results_without_filter = self._run_rpn_proposal(
          all_anchors, rpn_cls_prob, config, gt_boxes=gt_boxes
      )
  
      # Check that all_proposals contain the outside anchors
      self.assertAllEqual(
          results_without_filter["all_proposals"].shape,
          all_anchors.shape,
      )
  
      config["filter_outside_anchors"] = True
      results_with_filter = self._run_rpn_proposal(
          all_anchors, rpn_cls_prob, config, gt_boxes=gt_boxes
      )
      self.assertAllEqual(
          results_with_filter["all_proposals"].shape, (2, 4)
      )
  
file_path: luminoth/luminoth/models/fasterrcnn/rpn_proposal_test.py
imports: import numpy
  import tensorflow
  from easydict import EasyDict
  from luminoth.models.fasterrcnn.rpn_proposal import RPNProposal
  from luminoth.utils.bbox_transform_tf import encode, clip_boxes
label_desc: Use image node_id 8 for calling the RPNProposalTest obj's underlying member method code with example usage: obj.testFilterOutsideAnchors() without return types