class_docstr: Implementation of `End-to-End Semi-Supervised Object Detection
  with Soft Teacher <https://arxiv.org/abs/2106.09018>`_
  
  Args:
      detector (:obj:`ConfigDict` or dict): The detector config.
      semi_train_cfg (:obj:`ConfigDict` or dict, optional):
          The semi-supervised training config.
      semi_test_cfg (:obj:`ConfigDict` or dict, optional):
          The semi-supervised testing config.
      data_preprocessor (:obj:`ConfigDict` or dict, optional): Config of
          :class:`DetDataPreprocessor` to process the input data.
          Defaults to None.
      init_cfg (:obj:`ConfigDict` or list[:obj:`ConfigDict`] or dict or
          list[dict], optional): Initialization config dict.
          Defaults to None.
docstr: Compute uncertainty with augmented bboxes.
  
  Args:
      x (tuple[Tensor]): List of multi-level img features.
      batch_data_samples (List[:obj:`DetDataSample`]): The batch
          data samples. It usually includes information such
          as `gt_instance` or `gt_panoptic_seg` or `gt_sem_seg`,
          which are `pseudo_instance` or `pseudo_panoptic_seg`
          or `pseudo_sem_seg` in fact.
  
  Returns:
      list[Tensor]: A list of uncertainty for pseudo bboxes.
docstr_tok: ["Compute","uncertainty","with","augmented","bboxes",".","Args",":","x","(","tuple","[","Tensor","]",")",":","List","of","multi-level","img","features",".","batch_data_samples","(","List","[",":","obj",":","`","DetDataSample","`","]",")",":","The","batch","data","samples",".","It","usually","includes","information","such","as","`","gt_instance","`","or","`","gt_panoptic_seg","`","or","`","gt_sem_seg","`",",","which","are","`","pseudo_instance","`","or","`","pseudo_panoptic_seg","`","or","`","pseudo_sem_seg","`","in","fact",".","Returns",":","list","[","Tensor","]",":","A","list","of","uncertainty","for","pseudo","bboxes","."]
code: def compute_uncertainty_with_aug(
      self, x: Tuple[Tensor], batch_data_samples: SampleList
  ) -> List[Tensor]:
      """Compute uncertainty with augmented bboxes.
  
      Args:
          x (tuple[Tensor]): List of multi-level img features.
          batch_data_samples (List[:obj:`DetDataSample`]): The batch
              data samples. It usually includes information such
              as `gt_instance` or `gt_panoptic_seg` or `gt_sem_seg`,
              which are `pseudo_instance` or `pseudo_panoptic_seg`
              or `pseudo_sem_seg` in fact.
  
      Returns:
          list[Tensor]: A list of uncertainty for pseudo bboxes.
      """
      auged_results_list = self.aug_box(
          batch_data_samples,
          self.semi_train_cfg.jitter_times,
          self.semi_train_cfg.jitter_scale,
      )
      # flatten
      auged_results_list = [
          InstanceData(bboxes=auged.reshape(-1, auged.shape[-1]))
          for auged in auged_results_list
      ]
  
      self.teacher.roi_head.test_cfg = None
      results_list = self.teacher.roi_head.predict(
          x, auged_results_list, batch_data_samples, rescale=False
      )
      self.teacher.roi_head.test_cfg = self.teacher.test_cfg.rcnn
  
      reg_channel = (
          max([results.bboxes.shape[-1] for results in results_list])
          // 4
      )
      bboxes = [
          results.bboxes.reshape(
              self.semi_train_cfg.jitter_times,
              -1,
              results.bboxes.shape[-1],
          )
          if results.bboxes.numel() > 0
          else results.bboxes.new_zeros(
              self.semi_train_cfg.jitter_times, 0, 4 * reg_channel
          ).float()
          for results in results_list
      ]
  
      box_unc = [bbox.std(dim=0) for bbox in bboxes]
      bboxes = [bbox.mean(dim=0) for bbox in bboxes]
      labels = [
          data_samples.gt_instances.labels
          for data_samples in batch_data_samples
      ]
      if reg_channel != 1:
          bboxes = [
              bbox.reshape(bbox.shape[0], reg_channel, 4)[
                  torch.arange(bbox.shape[0]), label
              ]
              for bbox, label in zip(bboxes, labels)
          ]
          box_unc = [
              unc.reshape(unc.shape[0], reg_channel, 4)[
                  torch.arange(unc.shape[0]), label
              ]
              for unc, label in zip(box_unc, labels)
          ]
  
      box_shape = [
          (bbox[:, 2:4] - bbox[:, :2]).clamp(min=1.0) for bbox in bboxes
      ]
      box_unc = [
          torch.mean(
              unc / wh[:, None, :].expand(-1, 2, 2).reshape(-1, 4),
              dim=-1,
          )
          if wh.numel() > 0
          else unc
          for unc, wh in zip(box_unc, box_shape)
      ]
      return box_unc
  
imports: import copy
  from typing import List, Optional, Tuple
  import torch
  from mmengine.structures import InstanceData
  from torch import Tensor
  from mmdet.models.utils import filter_gt_instances, rename_loss_dict, reweight_loss_dict
  from mmdet.registry import MODELS
  from mmdet.structures import SampleList
  from mmdet.structures.bbox import bbox2roi, bbox_project
  from mmdet.utils import ConfigType, InstanceList, OptConfigType, OptMultiConfig
  from ..utils.misc import unpack_gt_instances
  from .semi_base import SemiBaseDetector
label_desc: Use image node_id 7 for calling the SoftTeacher obj's underlying member method code with example usage: obj.compute_uncertainty_with_aug(x, batch_data_samples) and returns: box_unc