def valid_preprocessing(x, size_target=(448, 448)):
    '''Preprocessing for validation dataset image.

    Args:
        x: input image.
        size_target: a tuple (height, width) of the target size.

    Returns:
        Preprocessed image.
    '''
    return normalize_image(center_crop_image(
        resize_image(x, size_target=size_target, flg_keep_aspect=True)),
                           mean=[123.82988033, 127.3509729, 110.25606303])
Beispiel #2
0
def train_preprocessing(x, size_target=(244, 244)):
    '''Preprocessing for train dataset image.

    Args:
        x: input image.
        size_target: a tuple (height, width) of the target size.

    Returns:
        Preprocessed image.
    '''
    return normalize_image(
        center_crop_image(
            horizontal_flip_image(
                resize_image(
                    x,
                    size_target=size_target,
                    flg_keep_aspect=True
                )
            )
        ),
        mean=[123.82988033, 127.3509729, 110.25606303]
    )