class_docstr: Translate the images, bboxes, masks and segmentation maps horizontally
  or vertically.
  
  Args:
      level (int | float): The level for Translate and should be in
          range [0,_MAX_LEVEL].
      prob (float): The probability for performing translation and
          should be in range [0, 1].
      img_fill_val (int | float | tuple): The filled value for image
          border. If float, the same fill value will be used for all
          the three channels of image. If tuple, the should be 3
          elements (e.g. equals the number of channels for image).
      seg_ignore_label (int): The fill value used for segmentation map.
          Note this value must equals ``ignore_label`` in ``semantic_head``
          of the corresponding config. Default 255.
      direction (str): The translate direction, either "horizontal"
          or "vertical".
      max_translate_offset (int | float): The maximum pixel's offset for
          Translate.
      random_negative_prob (float): The probability that turns the
          offset negative.
      min_size (int | float): The minimum pixel for filtering
          invalid bboxes after the translation.
class_docstr_tok: ["Translate","the","images",",","bboxes",",","masks","and","segmentation","maps","horizontally","or","vertically",".","Args",":","level","(","int","|","float",")",":","The","level","for","Translate","and","should","be","in","range","[","0",",","_MAX_LEVEL","]",".","prob","(","float",")",":","The","probability","for","performing","translation","and","should","be","in","range","[","0",",","1","]",".","img_fill_val","(","int","|","float","|","tuple",")",":","The","filled","value","for","image","border",".","If","float",",","the","same","fill","value","will","be","used","for","all","the","three","channels","of","image",".","If","tuple",",","the","should","be","3","elements","(","e.g",".","equals","the","number","of","channels","for","image",")",".","seg_ignore_label","(","int",")",":","The","fill","value","used","for","segmentation","map",".","Note","this","value","must","equals","``","ignore_label","``","in","``","semantic_head","``","of","the","corresponding","config",".","Default","255.","direction","(","str",")",":","The","translate","direction",",","either","``","horizontal","''","or","``","vertical","''",".","max_translate_offset","(","int","|","float",")",":","The","maximum","pixel","'s","offset","for","Translate",".","random_negative_prob","(","float",")",":","The","probability","that","turns","the","offset","negative",".","min_size","(","int","|","float",")",":","The","minimum","pixel","for","filtering","invalid","bboxes","after","the","translation","."]
code: def __init__(
      self,
      level,
      prob=0.5,
      img_fill_val=128,
      seg_ignore_label=255,
      direction="horizontal",
      max_translate_offset=250.0,
      random_negative_prob=0.5,
      min_size=0,
  ):
      assert isinstance(
          level, (int, float)
      ), "The level must be type int or float."
      assert 0 <= level <= _MAX_LEVEL, (
          "The level used for calculating Translate's offset should be "
          "in range [0,_MAX_LEVEL]"
      )
      assert (
          0 <= prob <= 1.0
      ), "The probability of translation should be in range [0, 1]."
      if isinstance(img_fill_val, (float, int)):
          img_fill_val = tuple([float(img_fill_val)] * 3)
      elif isinstance(img_fill_val, tuple):
          assert (
              len(img_fill_val) == 3
          ), "img_fill_val as tuple must have 3 elements."
          img_fill_val = tuple([float(val) for val in img_fill_val])
      else:
          raise ValueError("img_fill_val must be type float or tuple.")
      assert np.all(
          [0 <= val <= 255 for val in img_fill_val]
      ), "all elements of img_fill_val should between range [0,255]."
      assert direction in (
          "horizontal",
          "vertical",
      ), 'direction should be "horizontal" or "vertical".'
      assert isinstance(
          max_translate_offset, (int, float)
      ), "The max_translate_offset must be type int or float."
      # the offset used for translation
      self.offset = int(level_to_value(level, max_translate_offset))
      self.level = level
      self.prob = prob
      self.img_fill_val = img_fill_val
      self.seg_ignore_label = seg_ignore_label
      self.direction = direction
      self.max_translate_offset = max_translate_offset
      self.random_negative_prob = random_negative_prob
      self.min_size = min_size
  
imports: import copy
  import cv2
  import mmcv
  import numpy
  from ..builder import PIPELINES
  from .compose import Compose
label_desc: Use image node_id 1 to create a new Translate object from inherited base classes: object with example: obj = Translate(level, prob, img_fill_val, seg_ignore_label, direction, max_translate_offset, random_negative_prob, min_size)