class_docstr: ATSS head with visual-language fusion module.
  
  Args:
      early_fuse (bool): Whether to fuse visual and language features
          Defaults to False.
      use_checkpoint (bool): Whether to use checkpoint. Defaults to False.
      num_dyhead_blocks (int): Number of dynamic head blocks. Defaults to 6.
      lang_model_name (str): Name of the language model.
          Defaults to 'bert-base-uncased'.
class_docstr_tok: ["ATSS","head","with","visual-language","fusion","module",".","Args",":","early_fuse","(","bool",")",":","Whether","to","fuse","visual","and","language","features","Defaults","to","False",".","use_checkpoint","(","bool",")",":","Whether","to","use","checkpoint",".","Defaults","to","False",".","num_dyhead_blocks","(","int",")",":","Number","of","dynamic","head","blocks",".","Defaults","to","6.","lang_model_name","(","str",")",":","Name","of","the","language","model",".","Defaults","to","'bert-base-uncased","'","."]
docstr: Transform a single image's features extracted from the head into
  bbox results.
  
  Args:
      bbox_pred_list (list[Tensor]): Box energies / deltas from
          all scale levels of a single image, each item has shape
          (num_priors * 4, H, W).
      score_factor_list (list[Tensor]): Score factor from all scale
          levels of a single image, each item has shape
          (num_priors * 1, H, W).
      cls_logit_list (list[Tensor]): Box scores from all scale
          levels of a single image, each item has shape
          (num_priors * num_classes, H, W).
      mlvl_priors (list[Tensor]): Each element in the list is
          the priors of a single level in feature pyramid. In all
          anchor-based methods, it has shape (num_priors, 4). In
          all anchor-free methods, it has shape (num_priors, 2)
          when `with_stride=True`, otherwise it still has shape
          (num_priors, 4).
      token_positive_maps (dict): Token positive map.
      img_meta (dict): Image meta info.
      cfg (mmengine.Config): Test / postprocessing configuration,
          if None, test_cfg would be used.
      rescale (bool): If True, return boxes in original image space.
          Defaults to False.
      with_nms (bool): If True, do nms before return boxes.
          Defaults to True.
  
  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: ["Transform","a","single","image","'s","features","extracted","from","the","head","into","bbox","results",".","Args",":","bbox_pred_list","(","list","[","Tensor","]",")",":","Box","energies","\/","deltas","from","all","scale","levels","of","a","single","image",",","each","item","has","shape","(","num_priors","*","4",",","H",",","W",")",".","score_factor_list","(","list","[","Tensor","]",")",":","Score","factor","from","all","scale","levels","of","a","single","image",",","each","item","has","shape","(","num_priors","*","1",",","H",",","W",")",".","cls_logit_list","(","list","[","Tensor","]",")",":","Box","scores","from","all","scale","levels","of","a","single","image",",","each","item","has","shape","(","num_priors","*","num_classes",",","H",",","W",")",".","mlvl_priors","(","list","[","Tensor","]",")",":","Each","element","in","the","list","is","the","priors","of","a","single","level","in","feature","pyramid",".","In","all","anchor-based","methods",",","it","has","shape","(","num_priors",",","4",")",".","In","all","anchor-free","methods",",","it","has","shape","(","num_priors",",","2",")","when","`","with_stride=True","`",",","otherwise","it","still","has","shape","(","num_priors",",","4",")",".","token_positive_maps","(","dict",")",":","Token","positive","map",".","img_meta","(","dict",")",":","Image","meta","info",".","cfg","(","mmengine.Config",")",":","Test","\/","postprocessing","configuration",",","if","None",",","test_cfg","would","be","used",".","rescale","(","bool",")",":","If","True",",","return","boxes","in","original","image","space",".","Defaults","to","False",".","with_nms","(","bool",")",":","If","True",",","do","nms","before","return","boxes",".","Defaults","to","True",".","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 _predict_by_feat_single(
      self,
      bbox_pred_list: List[Tensor],
      score_factor_list: List[Tensor],
      cls_logit_list: List[Tensor],
      mlvl_priors: List[Tensor],
      token_positive_maps: dict,
      img_meta: dict,
      cfg: ConfigDict,
      rescale: bool = True,
      with_nms: bool = True,
  ) -> InstanceData:
      """Transform a single image's features extracted from the head into
      bbox results.
  
      Args:
          bbox_pred_list (list[Tensor]): Box energies / deltas from
              all scale levels of a single image, each item has shape
              (num_priors * 4, H, W).
          score_factor_list (list[Tensor]): Score factor from all scale
              levels of a single image, each item has shape
              (num_priors * 1, H, W).
          cls_logit_list (list[Tensor]): Box scores from all scale
              levels of a single image, each item has shape
              (num_priors * num_classes, H, W).
          mlvl_priors (list[Tensor]): Each element in the list is
              the priors of a single level in feature pyramid. In all
              anchor-based methods, it has shape (num_priors, 4). In
              all anchor-free methods, it has shape (num_priors, 2)
              when `with_stride=True`, otherwise it still has shape
              (num_priors, 4).
          token_positive_maps (dict): Token positive map.
          img_meta (dict): Image meta info.
          cfg (mmengine.Config): Test / postprocessing configuration,
              if None, test_cfg would be used.
          rescale (bool): If True, return boxes in original image space.
              Defaults to False.
          with_nms (bool): If True, do nms before return boxes.
              Defaults to True.
  
      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).
      """
      cfg = self.test_cfg if cfg is None else cfg
      cfg = copy.deepcopy(cfg)
      img_shape = img_meta["img_shape"]
      nms_pre = cfg.get("nms_pre", -1)
      score_thr = cfg.get("score_thr", 0)
  
      mlvl_bbox_preds = []
      mlvl_valid_priors = []
      mlvl_scores = []
      mlvl_labels = []
  
      for level_idx, (
          bbox_pred,
          score_factor,
          cls_logit,
          priors,
      ) in enumerate(
          zip(
              bbox_pred_list,
              score_factor_list,
              cls_logit_list,
              mlvl_priors,
          )
      ):
          bbox_pred = bbox_pred.permute(1, 2, 0).reshape(
              -1, self.bbox_coder.encode_size
          )
          score_factor = (
              score_factor.permute(1, 2, 0).reshape(-1).sigmoid()
          )
  
          scores = convert_grounding_to_cls_scores(
              logits=cls_logit.sigmoid()[None],
              positive_maps=[token_positive_maps],
          )[0]
  
          results = filter_scores_and_topk(
              scores,
              score_thr,
              nms_pre,
              dict(bbox_pred=bbox_pred, priors=priors),
          )
  
          scores, labels, keep_idxs, filtered_results = results
  
          bbox_pred = filtered_results["bbox_pred"]
          priors = filtered_results["priors"]
          score_factor = score_factor[keep_idxs]
          scores = torch.sqrt(scores * score_factor)
  
          mlvl_bbox_preds.append(bbox_pred)
          mlvl_valid_priors.append(priors)
          mlvl_scores.append(scores)
          mlvl_labels.append(labels)
  
      bbox_pred = torch.cat(mlvl_bbox_preds)
      priors = cat_boxes(mlvl_valid_priors)
      bboxes = self.bbox_coder.decode(
          priors, bbox_pred, max_shape=img_shape
      )
  
      results = InstanceData()
      results.bboxes = bboxes
      results.scores = torch.cat(mlvl_scores)
      results.labels = torch.cat(mlvl_labels)
  
      predictions = self._bbox_post_process(
          results=results,
          cfg=cfg,
          rescale=rescale,
          with_nms=with_nms,
          img_meta=img_meta,
      )
  
      if len(predictions) > 0:
          # Note: GLIP adopts a very strange bbox decoder logic,
          # and if 1 is not added here, it will not align with
          # the official mAP.
          predictions.bboxes[:, 2:] = predictions.bboxes[:, 2:] + 1
      return predictions
  
imports: import copy
  import math
  from typing import Callable, List, Optional, Sequence, Tuple, Union
  import torch
  import torch.nn
  import torch.nn.functional
  from mmcv.cnn import Scale
  from mmcv.ops.modulated_deform_conv import ModulatedDeformConv2d
  from mmengine.config import ConfigDict
  from mmengine.model import BaseModel
  from mmengine.structures import InstanceData
  from torch import Tensor
  from mmdet.registry import MODELS
  from mmdet.structures.bbox import cat_boxes
  from mmdet.utils import InstanceList, OptInstanceList, reduce_mean
  from ..utils import BertEncoderLayer, VLFuse, filter_scores_and_topk, permute_and_flatten, select_single_mlvl, unpack_gt_instances
  from ..utils.vlfuse_helper import MAX_CLAMP_VALUE
  from .atss_head import ATSSHead
label_desc: Use image node_id 11 for calling the ATSSVLFusionHead obj's underlying member method code with example usage: obj._predict_by_feat_single(bbox_pred_list, score_factor_list, cls_logit_list, mlvl_priors, token_positive_maps, img_meta, cfg, rescale, with_nms) and returns: predictions