class_docstr: Abstract object detector dataset module.
  
  This module implements some of the basic functionalities every object
  detector dataset usually needs.
  
  Object detection datasets are datasets that have ground-truth information
  consisting of rectangular bounding boxes.
  
  Attributes:
      dataset_dir (str): Base directory of the dataset.
      num_epochs (int): Number of epochs the dataset should iterate over.
      batch_size (int): Batch size the module should return.
      split (str): Split to consume the data from (usually "train", "val" or
          "test").
      image_min_size (int): Image minimum size, used for resizing images if
          needed.
      image_max_size (int): Image maximum size.
      random_shuffle (bool): To consume the dataset using random shuffle or
          to just use a regular FIFO queue.
docstr: Applies different data augmentation techniques.
  
  Uses the list of data augmentation configurations, each data
  augmentation technique has a probability assigned to it (or just uses
  the default value for the dataset).
  
  Procedures are applied sequentially on top of each other according to
  the order defined in the config.
  
  TODO: We need a better way to ensure order using YAML config without
  ending up with a list of single-key dictionaries.
  
  Args:
      image: A Tensor of shape (height, width, 3).
      bboxes: A Tensor of shape (total_bboxes, 5).
  
  Returns:
      image: A Tensor of shape (height, width, 3).
      bboxes: A Tensor of shape (total_bboxes, 5) of type tf.int32.
docstr_tok: ["Applies","different","data","augmentation","techniques",".","Uses","the","list","of","data","augmentation","configurations",",","each","data","augmentation","technique","has","a","probability","assigned","to","it","(","or","just","uses","the","default","value","for","the","dataset",")",".","Procedures","are","applied","sequentially","on","top","of","each","other","according","to","the","order","defined","in","the","config",".","TODO",":","We","need","a","better","way","to","ensure","order","using","YAML","config","without","ending","up","with","a","list","of","single-key","dictionaries",".","Args",":","image",":","A","Tensor","of","shape","(","height",",","width",",","3",")",".","bboxes",":","A","Tensor","of","shape","(","total_bboxes",",","5",")",".","Returns",":","image",":","A","Tensor","of","shape","(","height",",","width",",","3",")",".","bboxes",":","A","Tensor","of","shape","(","total_bboxes",",","5",")","of","type","tf.int32","."]
code: def _augment(self, image, bboxes=None, default_prob=0.5):
      """Applies different data augmentation techniques.
  
      Uses the list of data augmentation configurations, each data
      augmentation technique has a probability assigned to it (or just uses
      the default value for the dataset).
  
      Procedures are applied sequentially on top of each other according to
      the order defined in the config.
  
      TODO: We need a better way to ensure order using YAML config without
      ending up with a list of single-key dictionaries.
  
      Args:
          image: A Tensor of shape (height, width, 3).
          bboxes: A Tensor of shape (total_bboxes, 5).
  
      Returns:
          image: A Tensor of shape (height, width, 3).
          bboxes: A Tensor of shape (total_bboxes, 5) of type tf.int32.
      """
      applied_data_augmentation = []
      for aug_config in self._data_augmentation:
          if len(aug_config.keys()) != 1:
              raise ValueError(
                  'Invalid data_augmentation definition: "{}"'.format(
                      aug_config
                  )
              )
  
          aug_type = list(aug_config.keys())[0]
          if aug_type not in DATA_AUGMENTATION_STRATEGIES:
              tf.logging.warning(
                  'Invalid data augmentation strategy "{}". Ignoring'.format(
                      aug_type
                  )
              )
              continue
  
          aug_config = aug_config[aug_type]
          aug_fn = DATA_AUGMENTATION_STRATEGIES[aug_type]
  
          random_number = tf.random_uniform([], seed=self._seed)
          prob = tf.to_float(aug_config.pop("prob", default_prob))
          apply_aug_strategy = tf.less(random_number, prob)
  
          augmented = aug_fn(image, bboxes, **aug_config)
  
          image = tf.cond(
              apply_aug_strategy,
              lambda: augmented["image"],
              lambda: image,
          )
  
          if bboxes is not None:
              bboxes = tf.cond(
                  apply_aug_strategy,
                  lambda: augmented.get("bboxes"),
                  lambda: bboxes,
              )
  
          applied_data_augmentation.append(
              {aug_type: apply_aug_strategy}
          )
  
      return image, bboxes, applied_data_augmentation
  
file_path: luminoth/luminoth/datasets/object_detection_dataset.py
imports: import tensorflow
  from luminoth.datasets.base_dataset import BaseDataset
  from luminoth.utils.image import resize_image_fixed, resize_image, flip_image, random_patch, random_resize, random_distortion, expand
label_desc: Use image node_id 4 for calling the ObjectDetectionDataset obj's underlying member method code with example usage: obj._augment(image, bboxes, default_prob) and returns: image,  bboxes,  applied_data_augmentation