a03_augmentation.py 文件源码

python
阅读 37 收藏 0 点赞 0 评论 0

项目:KAGGLE_CERVICAL_CANCER_2017 作者: ZFTurbo 项目源码 文件源码
def random_augment_image(image, row):
    # start0_max, end0_max, start1_max, end1_max = get_bounding_boxes_positions(image, row)
    # image = cv2.rectangle(image, (int(start1_max), int(start0_max)), (int(end1_max), int(end0_max)), (0, 0, 255), thickness=5)
    if random.randint(0, 1) == 0:
        image = return_random_crop(image, row)
    else:
        image = return_random_perspective(image, row)
    image = random_rotate(image)

    # all possible mirroring and flips (in total there are only 8 possible configurations)
    mirror = random.randint(0, 1)
    if mirror != 0:
        image = image[::-1, :, :]
    angle = random.randint(0, 3)
    if angle != 0:
        image = np.rot90(image, k=angle)

    image = lightning_change(image)
    image = blur_image(image)

    return image
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号