docstr: Tests that we're respecting the limits imposed by the config.
docstr_tok: ["Tests","that","we","'re","respecting","the","limits","imposed","by","the","config","."]
code: def testLimits(self):
      """Tests that we're respecting the limits imposed by the config."""
  
      limits_config = self._config.copy()
      limits_config["class_max_detections"] = 2
      limits_config["total_max_detections"] = 3
      limits_config = EasyDict(limits_config)
      limits_num_classes = 2
      limits_model = RCNNProposal(limits_num_classes, limits_config)
  
      proposed_boxes = tf.constant(
          [
              (0, 0, 1, 1),  # class 0
              (5, 5, 10, 10),  # class 1
              (15, 15, 20, 20),  # class 1
              (25, 25, 30, 30),  # class 0
              (35, 35, 40, 40),
              (38, 40, 65, 65),
              (70, 50, 90, 90),  # class 0
              (95, 95, 100, 100),
              (105, 105, 110, 110),  # class 1
          ]
      )
      # All zeroes for our bbox_pred.
      bbox_pred = tf.constant([[0.0] * limits_num_classes * 4] * 9)
      cls_prob = tf.constant(
          [
              (0.0, 1.0, 0.0),
              (0.0, 0.2, 0.8),
              (0.0, 0.45, 0.55),
              (0.0, 0.55, 0.45),
              (1.0, 0.0, 0.0),
              (1.0, 0.0, 0.0),
              (0.0, 0.95, 0.05),
              (1.0, 0.0, 0.0),
              (0.0, 0.495, 0.505),
          ]
      )
  
      proposal_prediction = self._run_rcnn_proposal(
          limits_model,
          proposed_boxes,
          bbox_pred,
          cls_prob,
      )
      labels = proposal_prediction["proposal_label"]
      num_class0 = labels[labels == 0].shape[0]
      num_class1 = labels[labels == 1].shape[0]
  
      self.assertLessEqual(
          num_class0, limits_config.class_max_detections
      )
      self.assertLessEqual(
          num_class1, limits_config.class_max_detections
      )
      num_total = labels.shape[0]
      self.assertLessEqual(
          num_total, limits_config.total_max_detections
      )
  
file_path: luminoth/luminoth/models/fasterrcnn/rcnn_proposal_test.py
imports: import tensorflow
  from easydict import EasyDict
  from luminoth.models.fasterrcnn.rcnn_proposal import RCNNProposal
  from luminoth.utils.bbox_transform_tf import encode
label_desc: Use image node_id 10 for calling the RCNNProposalTest obj's underlying member method code with example usage: obj.testLimits() without return types