class_docstr: Multiple branch pipeline wrapper.
  
  Generate multiple data-augmented versions of the same image.
  `MultiBranch` needs to specify the branch names of all
  pipelines of the dataset, perform corresponding data augmentation
  for the current branch, and return None for other branches,
  which ensures the consistency of return format across
  different samples.
  
  Args:
      branch_field (list): List of branch names.
      branch_pipelines (dict): Dict of different pipeline configs
          to be composed.
  
  Examples:
      >>> branch_field = ['sup', 'unsup_teacher', 'unsup_student']
      >>> sup_pipeline = [
      >>>     dict(type='LoadImageFromFile'),
      >>>     dict(type='LoadAnnotations', with_bbox=True),
      >>>     dict(type='Resize', scale=(1333, 800), keep_ratio=True),
      >>>     dict(type='RandomFlip', prob=0.5),
      >>>     dict(
      >>>         type='MultiBranch',
      >>>         branch_field=branch_field,
      >>>         sup=dict(type='PackDetInputs'))
      >>>     ]
      >>> weak_pipeline = [
      >>>     dict(type='LoadImageFromFile'),
      >>>     dict(type='LoadAnnotations', with_bbox=True),
      >>>     dict(type='Resize', scale=(1333, 800), keep_ratio=True),
      >>>     dict(type='RandomFlip', prob=0.0),
      >>>     dict(
      >>>         type='MultiBranch',
      >>>         branch_field=branch_field,
      >>>         sup=dict(type='PackDetInputs'))
      >>>     ]
      >>> strong_pipeline = [
      >>>     dict(type='LoadImageFromFile'),
      >>>     dict(type='LoadAnnotations', with_bbox=True),
      >>>     dict(type='Resize', scale=(1333, 800), keep_ratio=True),
      >>>     dict(type='RandomFlip', prob=1.0),
      >>>     dict(
      >>>         type='MultiBranch',
      >>>         branch_field=branch_field,
      >>>         sup=dict(type='PackDetInputs'))
      >>>     ]
      >>> unsup_pipeline = [
      >>>     dict(type='LoadImageFromFile'),
      >>>     dict(type='LoadEmptyAnnotations'),
      >>>     dict(
      >>>         type='MultiBranch',
      >>>         branch_field=branch_field,
      >>>         unsup_teacher=weak_pipeline,
      >>>         unsup_student=strong_pipeline)
      >>>     ]
      >>> from mmcv.transforms import Compose
      >>> sup_branch = Compose(sup_pipeline)
      >>> unsup_branch = Compose(unsup_pipeline)
      >>> print(sup_branch)
      >>> Compose(
      >>>     LoadImageFromFile(ignore_empty=False, to_float32=False, color_type='color', imdecode_backend='cv2') # noqa
      >>>     LoadAnnotations(with_bbox=True, with_label=True, with_mask=False, with_seg=False, poly2mask=True, imdecode_backend='cv2') # noqa
      >>>     Resize(scale=(1333, 800), scale_factor=None, keep_ratio=True, clip_object_border=True), backend=cv2), interpolation=bilinear) # noqa
      >>>     RandomFlip(prob=0.5, direction=horizontal)
      >>>     MultiBranch(branch_pipelines=['sup'])
      >>> )
      >>> print(unsup_branch)
      >>> Compose(
      >>>     LoadImageFromFile(ignore_empty=False, to_float32=False, color_type='color', imdecode_backend='cv2') # noqa
      >>>     LoadEmptyAnnotations(with_bbox=True, with_label=True, with_mask=False, with_seg=False, seg_ignore_label=255) # noqa
      >>>     MultiBranch(branch_pipelines=['unsup_teacher', 'unsup_student'])
      >>> )
docstr: Transform function to apply transforms sequentially.
  
  Args:
      results (dict): Result dict from loading pipeline.
  
  Returns:
      dict:
  
      - 'inputs' (Dict[str, obj:`torch.Tensor`]): The forward data of
          models from different branches.
      - 'data_sample' (Dict[str,obj:`DetDataSample`]): The annotation
          info of the sample from different branches.
docstr_tok: ["Transform","function","to","apply","transforms","sequentially",".","Args",":","results","(","dict",")",":","Result","dict","from","loading","pipeline",".","Returns",":","dict",":","-","'inputs","'","(","Dict","[","str",",","obj",":","`","torch.Tensor","`","]",")",":","The","forward","data","of","models","from","different","branches",".","-","'data_sample","'","(","Dict","[","str",",","obj",":","`","DetDataSample","`","]",")",":","The","annotation","info","of","the","sample","from","different","branches","."]
code: def transform(self, results: dict) -> dict:
      """Transform function to apply transforms sequentially.
  
      Args:
          results (dict): Result dict from loading pipeline.
  
      Returns:
          dict:
  
          - 'inputs' (Dict[str, obj:`torch.Tensor`]): The forward data of
              models from different branches.
          - 'data_sample' (Dict[str,obj:`DetDataSample`]): The annotation
              info of the sample from different branches.
      """
  
      multi_results = {}
      for branch in self.branch_field:
          multi_results[branch] = {"inputs": None, "data_samples": None}
      for branch, pipeline in self.branch_pipelines.items():
          branch_results = pipeline(copy.deepcopy(results))
          # If one branch pipeline returns None,
          # it will sample another data from dataset.
          if branch_results is None:
              return None
          multi_results[branch] = branch_results
  
      format_results = {}
      for branch, results in multi_results.items():
          for key in results.keys():
              if format_results.get(key, None) is None:
                  format_results[key] = {branch: results[key]}
              else:
                  format_results[key][branch] = results[key]
      return format_results
  
imports: import copy
  from typing import Callable, Dict, List, Optional, Union
  import numpy
  from mmcv.transforms import BaseTransform, Compose
  from mmcv.transforms.utils import cache_random_params, cache_randomness
  from mmdet.registry import TRANSFORMS
label_desc: Use image node_id 2 for calling the MultiBranch obj's underlying member method code with example usage: obj.transform(results) and returns: format_results, None