Data augmentation for detectron2 models


RotationTransform.apply_rotated_box

 RotationTransform.apply_rotated_box (rotated_boxes)

rotated_boxes should be a N*5 array-like, containing N couples of(x_center, y_center, width, height, angle) boxes


source

VFlip_rotated_box

 VFlip_rotated_box (transform, rotated_boxes)

Apply the vertical flip transform on rotated boxes.

Args: rotated_boxes (ndarray): Nx5 floating point array of (x_center, y_center, width, height, angle_degrees) format in absolute coodinates


source

build_aug_transforms

 build_aug_transforms (cfg:detectron2.config.config.CfgNode,
                       flip_horiz:bool=True, flip_vert:bool=False,
                       max_rotate:int=10,
                       brightness_limits:Tuple[int,int]=(0.8, 1.4),
                       contrast_limits:Tuple[int,int]=(0.8, 1.4),
                       saturation_limits:Tuple[int,int]=(0.8, 1.4),
                       p_lighting:float=0.75)

Build a list of detectron2 augmentations