docstr: Args:
      proposals: BoxProposals
      stage: 0, 1, 2
  
  Returns:
      FastRCNNHead
      Nx4, updated boxes
docstr_tok: ["Args",":","proposals",":","BoxProposals","stage",":","0",",","1",",","2","Returns",":","FastRCNNHead","Nx4",",","updated","boxes"]
code: def run_head(self, proposals, stage):
      """
      Args:
          proposals: BoxProposals
          stage: 0, 1, 2
  
      Returns:
          FastRCNNHead
          Nx4, updated boxes
      """
      reg_weights = tf.constant(
          cfg.CASCADE.BBOX_REG_WEIGHTS[stage], dtype=tf.float32
      )
      pooled_feature = self.roi_func(proposals.boxes)  # N,C,S,S
      pooled_feature = self.scale_gradient(pooled_feature)
      head_feature = self.fastrcnn_head_func("head", pooled_feature)
      label_logits, box_logits = fastrcnn_outputs(
          "outputs",
          head_feature,
          self.num_categories,
          class_agnostic_regression=True,
      )
      head = FastRCNNHead(
          proposals,
          box_logits,
          label_logits,
          self.gt_boxes,
          reg_weights,
      )
  
      refined_boxes = head.decoded_output_boxes_class_agnostic()
      refined_boxes = clip_boxes(refined_boxes, self.image_shape2d)
      if self.training:
          refined_boxes = tf.boolean_mask(
              refined_boxes, tf_area(refined_boxes) > 0
          )
      return head, tf.stop_gradient(refined_boxes, name="output_boxes")
  
file_path: tensorpack/examples/FasterRCNN/modeling/model_cascade.py
imports: import tensorflow
  from tensorpack.tfutils import get_current_tower_context
  from config import config
  from utils.box_ops import pairwise_iou, area
  from .model_box import clip_boxes
  from .model_frcnn import BoxProposals, FastRCNNHead, fastrcnn_outputs
label_desc: Use image node_id 2 for calling the CascadeRCNNHead obj's underlying member method code with example usage: obj.run_head(proposals, stage) and returns: head,  tf