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: Get pseudo instances from teacher model.
docstr_tok: ["Get","pseudo","instances","from","teacher","model","."]
code: def get_pseudo_instances(
      self, batch_inputs: Tensor, batch_data_samples: SampleList
  ) -> Tuple[SampleList, Optional[dict]]:
      """Get pseudo instances from teacher model."""
      assert self.teacher.with_bbox, "Bbox head must be implemented."
      x = self.teacher.extract_feat(batch_inputs)
  
      # If there are no pre-defined proposals, use RPN to get proposals
      if batch_data_samples[0].get("proposals", None) is None:
          rpn_results_list = self.teacher.rpn_head.predict(
              x, batch_data_samples, rescale=False
          )
      else:
          rpn_results_list = [
              data_sample.proposals
              for data_sample in batch_data_samples
          ]
  
      results_list = self.teacher.roi_head.predict(
          x, rpn_results_list, batch_data_samples, rescale=False
      )
  
      for data_samples, results in zip(
          batch_data_samples, results_list
      ):
          data_samples.gt_instances = results
  
      batch_data_samples = filter_gt_instances(
          batch_data_samples,
          score_thr=self.semi_train_cfg.pseudo_label_initial_score_thr,
      )
  
      reg_uncs_list = self.compute_uncertainty_with_aug(
          x, batch_data_samples
      )
  
      for data_samples, reg_uncs in zip(
          batch_data_samples, reg_uncs_list
      ):
          data_samples.gt_instances["reg_uncs"] = reg_uncs
          data_samples.gt_instances.bboxes = bbox_project(
              data_samples.gt_instances.bboxes,
              torch.from_numpy(data_samples.homography_matrix)
              .inverse()
              .to(self.data_preprocessor.device),
              data_samples.ori_shape,
          )
  
      batch_info = {
          "feat": x,
          "img_shape": [],
          "homography_matrix": [],
          "metainfo": [],
      }
      for data_samples in batch_data_samples:
          batch_info["img_shape"].append(data_samples.img_shape)
          batch_info["homography_matrix"].append(
              torch.from_numpy(data_samples.homography_matrix).to(
                  self.data_preprocessor.device
              )
          )
          batch_info["metainfo"].append(data_samples.metainfo)
      return batch_data_samples, batch_info
  
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 3 for calling the SoftTeacher obj's underlying member method code with example usage: obj.get_pseudo_instances(batch_inputs, batch_data_samples) and returns: batch_data_samples,  batch_info