Skip to content

ez-frcnn.image_augs


def image_augs.get_train_transform():

Returns a composition of data augmentation transforms for training images and bounding boxes.

Inputs

None

Output

albumentations.Compose: A composition of image transformations applied with specified probabilities, including flipping, rotation, blurring, and tensor conversion, with bounding box support in Pascal VOC format.

Source code in library/image_augs.py
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
def get_train_transform():
    """
    Returns a composition of data augmentation transforms for training images and bounding boxes.

    Inputs:
        None

    Output:
        albumentations.Compose: A composition of image transformations applied with specified probabilities,
                                including flipping, rotation, blurring, and tensor conversion, with bounding
                                box support in Pascal VOC format.
    """
    return A.Compose([
        A.Flip(0.5),
        A.RandomRotate90(0.5),
        A.MotionBlur(p=0.2),
        A.MedianBlur(blur_limit=3, p=0.1),
        A.Blur(blur_limit=3, p=0.1),
        ToTensorV2(p=1.0),
    ], bbox_params={
        'format': 'pascal_voc',
        'label_fields': ['labels']
    })

def image_augs.get_valid_transform():

Returns the transformation applied to validation images and bounding boxes.

Inputs

None

Output

albumentations.Compose: A composition that converts images and bounding boxes to tensors, with bounding box support in Pascal VOC format.

Source code in library/image_augs.py
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
def get_valid_transform():
    """
    Returns the transformation applied to validation images and bounding boxes.

    Inputs:
        None

    Output:
        albumentations.Compose: A composition that converts images and bounding boxes to tensors,
                                with bounding box support in Pascal VOC format.
    """
    return A.Compose([
        ToTensorV2(p=1.0),
    ], bbox_params={
        'format': 'pascal_voc', 
        'label_fields': ['labels']
    })