class_docstr: Random affine transform data augmentation.
  
  This operation randomly generates affine transform matrix which including
  rotation, translation, shear and scaling transforms.
  
  Required Keys:
  
  - img
  - gt_bboxes (BaseBoxes[torch.float32]) (optional)
  - gt_bboxes_labels (np.int64) (optional)
  - gt_ignore_flags (bool) (optional)
  
  Modified Keys:
  
  - img
  - img_shape
  - gt_bboxes (optional)
  - gt_bboxes_labels (optional)
  - gt_ignore_flags (optional)
  
  Args:
      max_rotate_degree (float): Maximum degrees of rotation transform.
          Defaults to 10.
      max_translate_ratio (float): Maximum ratio of translation.
          Defaults to 0.1.
      scaling_ratio_range (tuple[float]): Min and max ratio of
          scaling transform. Defaults to (0.5, 1.5).
      max_shear_degree (float): Maximum degrees of shear
          transform. Defaults to 2.
      border (tuple[int]): Distance from width and height sides of input
          image to adjust output shape. Only used in mosaic dataset.
          Defaults to (0, 0).
      border_val (tuple[int]): Border padding values of 3 channels.
          Defaults to (114, 114, 114).
      bbox_clip_border (bool, optional): Whether to clip the objects outside
          the border of the image. In some dataset like MOT17, the gt bboxes
          are allowed to cross the border of images. Therefore, we don't
          need to clip the gt bboxes in these cases. Defaults to True.
class_docstr_tok: ["Random","affine","transform","data","augmentation",".","This","operation","randomly","generates","affine","transform","matrix","which","including","rotation",",","translation",",","shear","and","scaling","transforms",".","Required","Keys",":","-","img","-","gt_bboxes","(","BaseBoxes","[","torch.float32","]",")","(","optional",")","-","gt_bboxes_labels","(","np.int64",")","(","optional",")","-","gt_ignore_flags","(","bool",")","(","optional",")","Modified","Keys",":","-","img","-","img_shape","-","gt_bboxes","(","optional",")","-","gt_bboxes_labels","(","optional",")","-","gt_ignore_flags","(","optional",")","Args",":","max_rotate_degree","(","float",")",":","Maximum","degrees","of","rotation","transform",".","Defaults","to","10.","max_translate_ratio","(","float",")",":","Maximum","ratio","of","translation",".","Defaults","to","0.1.","scaling_ratio_range","(","tuple","[","float","]",")",":","Min","and","max","ratio","of","scaling","transform",".","Defaults","to","(","0.5",",","1.5",")",".","max_shear_degree","(","float",")",":","Maximum","degrees","of","shear","transform",".","Defaults","to","2.","border","(","tuple","[","int","]",")",":","Distance","from","width","and","height","sides","of","input","image","to","adjust","output","shape",".","Only","used","in","mosaic","dataset",".","Defaults","to","(","0",",","0",")",".","border_val","(","tuple","[","int","]",")",":","Border","padding","values","of","3","channels",".","Defaults","to","(","114",",","114",",","114",")",".","bbox_clip_border","(","bool",",","optional",")",":","Whether","to","clip","the","objects","outside","the","border","of","the","image",".","In","some","dataset","like","MOT17",",","the","gt","bboxes","are","allowed","to","cross","the","border","of","images",".","Therefore",",","we","don't","need","to","clip","the","gt","bboxes","in","these","cases",".","Defaults","to","True","."]
code: def _get_scaling_matrix(scale_ratio: float) -> np.ndarray:
      scaling_matrix = np.array(
          [
              [scale_ratio, 0.0, 0.0],
              [0.0, scale_ratio, 0.0],
              [0.0, 0.0, 1.0],
          ],
          dtype=np.float32,
      )
      return scaling_matrix
  
imports: import collections
  import copy
  import logging
  import math
  from typing import Dict, List, Optional, Sequence, Tuple, Union
  import mmcv
  import numpy
  import pandas
  import torch
  from mmcv.transforms import BaseTransform
  from mmcv.transforms.utils import cache_randomness
  from mmdet.structures.bbox import autocast_box_type
  from mmdet.utils import log_img_scale
  from mmengine.config import Config
  from mmengine.dataset import BaseDataset
  from numpy import random
  from ...constants import GET_ITEM_ERROR_RETRY, MULTI_IMAGE_MIX_DATASET, ROIS
  from ..preprocess_dataframe import MultiModalFeaturePreprocessor
  from ..utils import apply_data_processor, apply_df_preprocessor, get_per_sample_features
label_desc: Use image node_id 6 for calling the RandomAffine obj's underlying member method code with example usage: obj._get_scaling_matrix(scale_ratio) and returns: scaling_matrix