docstr: Tests that we're not returning an object with background class.
  
  For this, we make sure all predictions have a class between 0 and 2.
  That is, even though we have four classes (three plus background),
  background is completely ignored.
docstr_tok: ["Tests","that","we","'re","not","returning","an","object","with","background","class",".","For","this",",","we","make","sure","all","predictions","have","a","class","between","0","and","2",".","That","is",",","even","though","we","have","four","classes","(","three","plus","background",")",",","background","is","completely","ignored","."]
code: def testNoBackgroundClass(self):
      """Tests that we're not returning an object with background class.
  
      For this, we make sure all predictions have a class between 0 and 2.
      That is, even though we have four classes (three plus background),
      background is completely ignored.
      """
  
      proposed_boxes = tf.constant(
          [
              (85, 500, 730, 590),
              (50, 500, 70, 530),
              (700, 570, 740, 598),
          ]
      )
      gt_boxes_per_class = tf.constant(
          [
              [(101, 101, 201, 249)],
              [(200, 502, 209, 532)],
              [(86, 571, 743, 599)],
          ]
      )
      bbox_pred = self._get_bbox_pred(
          proposed_boxes, gt_boxes_per_class
      )
  
      # We build one prediction for each class.
      cls_prob = tf.constant(
          [
              (0.0, 0.3, 0.3, 0.4),
              (0.8, 0.0, 0.0, 2.0),
              (0.35, 0.3, 0.2, 0.15),
          ]
      )
  
      proposal_prediction = self._run_rcnn_proposal(
          self._shared_model,
          proposed_boxes,
          bbox_pred,
          cls_prob,
      )
  
      # Make sure we get 3 predictions, one per class (as they're NMSed int
      # a single one).
      self.assertEqual(len(proposal_prediction["objects"]), 3)
      self.assertIn(0, proposal_prediction["proposal_label"])
      self.assertIn(1, proposal_prediction["proposal_label"])
      self.assertIn(2, proposal_prediction["proposal_label"])
  
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 6 for calling the RCNNProposalTest obj's underlying member method code with example usage: obj.testNoBackgroundClass() without return types