docstr: Setup the model and optimizer which are used in every test method.
  
  TestCase calls functions in this order: setUp() -> testMethod() ->
  tearDown() -> cleanUp()
docstr_tok: ["Setup","the","model","and","optimizer","which","are","used","in","every","test","method",".","TestCase","calls","functions","in","this","order",":","setUp","(",")","-",">","testMethod","(",")","-",">","tearDown","(",")","-",">","cleanUp","(",")"]
code: def setUp(self):
      """Setup the model and optimizer which are used in every test method.
  
      TestCase calls functions in this order: setUp() -> testMethod() ->
      tearDown() -> cleanUp()
      """
      data_prefix = osp.join(osp.dirname(__file__), "../../data")
      img_path = osp.join(data_prefix, "color.jpg")
      seg_map = osp.join(data_prefix, "gray.jpg")
      self.meta_keys = (
          "img_id",
          "img_path",
          "ori_shape",
          "img_shape",
          "scale_factor",
          "flip",
          "flip_direction",
          "homography_matrix",
      )
      self.results = {
          "img_path": img_path,
          "img_id": 12345,
          "img_shape": (300, 400),
          "seg_map_path": seg_map,
          "instances": [
              {
                  "bbox": [0, 0, 10, 20],
                  "bbox_label": 1,
                  "mask": [[0, 0, 0, 20, 10, 20, 10, 0]],
                  "ignore_flag": 0,
              },
              {
                  "bbox": [10, 10, 110, 120],
                  "bbox_label": 2,
                  "mask": [[10, 10, 110, 10, 110, 120, 110, 10]],
                  "ignore_flag": 0,
              },
              {
                  "bbox": [50, 50, 60, 80],
                  "bbox_label": 2,
                  "mask": [[50, 50, 60, 50, 60, 80, 50, 80]],
                  "ignore_flag": 1,
              },
          ],
      }
      self.branch_field = ["sup", "sup_teacher", "sup_student"]
      self.weak_pipeline = [
          dict(type="ShearX"),
          dict(type="PackDetInputs", meta_keys=self.meta_keys),
      ]
      self.strong_pipeline = [
          dict(type="ShearX"),
          dict(type="ShearY"),
          dict(type="PackDetInputs", meta_keys=self.meta_keys),
      ]
      self.labeled_pipeline = [
          dict(type="LoadImageFromFile"),
          dict(
              type="LoadAnnotations",
              with_bbox=True,
              with_mask=True,
              with_seg=True,
          ),
          dict(type="Resize", scale=(1333, 800), keep_ratio=True),
          dict(type="RandomFlip", prob=0.5),
          dict(
              type="MultiBranch",
              branch_field=self.branch_field,
              sup_teacher=self.weak_pipeline,
              sup_student=self.strong_pipeline,
          ),
      ]
      self.unlabeled_pipeline = [
          dict(type="LoadImageFromFile"),
          dict(type="Resize", scale=(1333, 800), keep_ratio=True),
          dict(type="RandomFlip", prob=0.5),
          dict(
              type="MultiBranch",
              branch_field=self.branch_field,
              unsup_teacher=self.weak_pipeline,
              unsup_student=self.strong_pipeline,
          ),
      ]
  
file_path: mmdetection/tests/test_datasets/test_transforms/test_wrappers.py
imports: import copy
  import os.path
  import unittest
  from mmcv.transforms import Compose
  from mmdet.datasets.transforms import MultiBranch, RandomOrder
  from mmdet.utils import register_all_modules
  from .utils import construct_toy_data
label_desc: Use image node_id 1 for calling the TestMultiBranch obj's underlying member method code with example usage: obj.setUp() without return types