class_docstr: YOLOXHead head used in `YOLOX <https://arxiv.org/abs/2107.08430>`_.
  
  Args:
      num_classes (int): Number of categories excluding the background
          category.
      in_channels (int): Number of channels in the input feature map.
      feat_channels (int): Number of hidden channels in stacking convs.
          Defaults to 256
      stacked_convs (int): Number of stacking convs of the head.
          Defaults to (8, 16, 32).
      strides (Sequence[int]): Downsample factor of each feature map.
           Defaults to None.
      use_depthwise (bool): Whether to depthwise separable convolution in
          blocks. Defaults to False.
      dcn_on_last_conv (bool): If true, use dcn in the last layer of
          towers. Defaults to False.
      conv_bias (bool or str): If specified as `auto`, it will be decided by
          the norm_cfg. Bias of conv will be set as True if `norm_cfg` is
          None, otherwise False. Defaults to "auto".
      conv_cfg (:obj:`ConfigDict` or dict, optional): Config dict for
          convolution layer. Defaults to None.
      norm_cfg (:obj:`ConfigDict` or dict): Config dict for normalization
          layer. Defaults to dict(type='BN', momentum=0.03, eps=0.001).
      act_cfg (:obj:`ConfigDict` or dict): Config dict for activation layer.
          Defaults to None.
      loss_cls (:obj:`ConfigDict` or dict): Config of classification loss.
      loss_bbox (:obj:`ConfigDict` or dict): Config of localization loss.
      loss_obj (:obj:`ConfigDict` or dict): Config of objectness loss.
      loss_l1 (:obj:`ConfigDict` or dict): Config of L1 loss.
      train_cfg (:obj:`ConfigDict` or dict, optional): Training config of
          anchor head. Defaults to None.
      test_cfg (:obj:`ConfigDict` or dict, optional): Testing config of
          anchor head. Defaults to None.
      init_cfg (:obj:`ConfigDict` or list[:obj:`ConfigDict`] or dict or
          list[dict], optional): Initialization config dict.
          Defaults to None.
class_docstr_tok: ["YOLOXHead","head","used","in","`","YOLOX","<","https",":","\/\/arxiv.org\/abs\/2107.08430",">","`","_",".","Args",":","num_classes","(","int",")",":","Number","of","categories","excluding","the","background","category",".","in_channels","(","int",")",":","Number","of","channels","in","the","input","feature","map",".","feat_channels","(","int",")",":","Number","of","hidden","channels","in","stacking","convs",".","Defaults","to","256","stacked_convs","(","int",")",":","Number","of","stacking","convs","of","the","head",".","Defaults","to","(","8",",","16",",","32",")",".","strides","(","Sequence","[","int","]",")",":","Downsample","factor","of","each","feature","map",".","Defaults","to","None",".","use_depthwise","(","bool",")",":","Whether","to","depthwise","separable","convolution","in","blocks",".","Defaults","to","False",".","dcn_on_last_conv","(","bool",")",":","If","true",",","use","dcn","in","the","last","layer","of","towers",".","Defaults","to","False",".","conv_bias","(","bool","or","str",")",":","If","specified","as","`","auto","`",",","it","will","be","decided","by","the","norm_cfg",".","Bias","of","conv","will","be","set","as","True","if","`","norm_cfg","`","is","None",",","otherwise","False",".","Defaults","to","``","auto","''",".","conv_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","Config","dict","for","convolution","layer",".","Defaults","to","None",".","norm_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","Config","dict","for","normalization","layer",".","Defaults","to","dict","(","type='BN","'",",","momentum=0.03",",","eps=0.001",")",".","act_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","Config","dict","for","activation","layer",".","Defaults","to","None",".","loss_cls","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","Config","of","classification","loss",".","loss_bbox","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","Config","of","localization","loss",".","loss_obj","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","Config","of","objectness","loss",".","loss_l1","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","Config","of","L1","loss",".","train_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","Training","config","of","anchor","head",".","Defaults","to","None",".","test_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","Testing","config","of","anchor","head",".","Defaults","to","None",".","init_cfg","(",":","obj",":","`","ConfigDict","`","or","list","[",":","obj",":","`","ConfigDict","`","]","or","dict","or","list","[","dict","]",",","optional",")",":","Initialization","config","dict",".","Defaults","to","None","."]
docstr: bbox post-processing method.
  
  The boxes would be rescaled to the original image scale and do
  the nms operation. Usually `with_nms` is False is used for aug test.
  
  Args:
      results (:obj:`InstaceData`): Detection instance results,
          each item has shape (num_bboxes, ).
      cfg (mmengine.Config): Test / postprocessing configuration,
          if None, test_cfg would be used.
      rescale (bool): If True, return boxes in original image space.
          Default to False.
      with_nms (bool): If True, do nms before return boxes.
          Default to True.
      img_meta (dict, optional): Image meta info. Defaults to None.
  
  Returns:
      :obj:`InstanceData`: Detection results of each image
      after the post process.
      Each item usually contains following keys.
  
      - scores (Tensor): Classification scores, has a shape
        (num_instance, )
      - labels (Tensor): Labels of bboxes, has a shape
        (num_instances, ).
      - bboxes (Tensor): Has a shape (num_instances, 4),
        the last dimension 4 arrange as (x1, y1, x2, y2).
docstr_tok: ["bbox","post-processing","method",".","The","boxes","would","be","rescaled","to","the","original","image","scale","and","do","the","nms","operation",".","Usually","`","with_nms","`","is","False","is","used","for","aug","test",".","Args",":","results","(",":","obj",":","`","InstaceData","`",")",":","Detection","instance","results",",","each","item","has","shape","(","num_bboxes",",",")",".","cfg","(","mmengine.Config",")",":","Test","\/","postprocessing","configuration",",","if","None",",","test_cfg","would","be","used",".","rescale","(","bool",")",":","If","True",",","return","boxes","in","original","image","space",".","Default","to","False",".","with_nms","(","bool",")",":","If","True",",","do","nms","before","return","boxes",".","Default","to","True",".","img_meta","(","dict",",","optional",")",":","Image","meta","info",".","Defaults","to","None",".","Returns",":",":","obj",":","`","InstanceData","`",":","Detection","results","of","each","image","after","the","post","process",".","Each","item","usually","contains","following","keys",".","-","scores","(","Tensor",")",":","Classification","scores",",","has","a","shape","(","num_instance",",",")","-","labels","(","Tensor",")",":","Labels","of","bboxes",",","has","a","shape","(","num_instances",",",")",".","-","bboxes","(","Tensor",")",":","Has","a","shape","(","num_instances",",","4",")",",","the","last","dimension","4","arrange","as","(","x1",",","y1",",","x2",",","y2",")","."]
code: def _bbox_post_process(
      self,
      results: InstanceData,
      cfg: ConfigDict,
      rescale: bool = False,
      with_nms: bool = True,
      img_meta: Optional[dict] = None,
  ) -> InstanceData:
      """bbox post-processing method.
  
      The boxes would be rescaled to the original image scale and do
      the nms operation. Usually `with_nms` is False is used for aug test.
  
      Args:
          results (:obj:`InstaceData`): Detection instance results,
              each item has shape (num_bboxes, ).
          cfg (mmengine.Config): Test / postprocessing configuration,
              if None, test_cfg would be used.
          rescale (bool): If True, return boxes in original image space.
              Default to False.
          with_nms (bool): If True, do nms before return boxes.
              Default to True.
          img_meta (dict, optional): Image meta info. Defaults to None.
  
      Returns:
          :obj:`InstanceData`: Detection results of each image
          after the post process.
          Each item usually contains following keys.
  
          - scores (Tensor): Classification scores, has a shape
            (num_instance, )
          - labels (Tensor): Labels of bboxes, has a shape
            (num_instances, ).
          - bboxes (Tensor): Has a shape (num_instances, 4),
            the last dimension 4 arrange as (x1, y1, x2, y2).
      """
  
      if rescale:
          assert img_meta.get("scale_factor") is not None
          results.bboxes /= results.bboxes.new_tensor(
              img_meta["scale_factor"]
          ).repeat((1, 2))
  
      if with_nms and results.bboxes.numel() > 0:
          det_bboxes, keep_idxs = batched_nms(
              results.bboxes, results.scores, results.labels, cfg.nms
          )
          results = results[keep_idxs]
          # some nms would reweight the score, such as softnms
          results.scores = det_bboxes[:, -1]
      return results
  
imports: import math
  from typing import List, Optional, Sequence, Tuple, Union
  import torch
  import torch.nn
  import torch.nn.functional
  from mmcv.cnn import ConvModule, DepthwiseSeparableConvModule
  from mmcv.ops.nms import batched_nms
  from mmengine.config import ConfigDict
  from mmengine.model import bias_init_with_prob
  from mmengine.structures import InstanceData
  from torch import Tensor
  from mmdet.registry import MODELS, TASK_UTILS
  from mmdet.structures.bbox import bbox_xyxy_to_cxcywh
  from mmdet.utils import ConfigType, OptConfigType, OptInstanceList, OptMultiConfig, reduce_mean
  from ..task_modules.prior_generators import MlvlPointGenerator
  from ..task_modules.samplers import PseudoSampler
  from ..utils import multi_apply
  from .base_dense_head import BaseDenseHead
label_desc: Use image node_id 10 for calling the YOLOXHead obj's underlying member method code with example usage: obj._bbox_post_process(results, cfg, rescale, with_nms, img_meta) and returns: results