data.py 文件源码

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

项目:DeepScript 作者: mikekestemont 项目源码 文件源码
def perturb_multiscale_fixed(img, scale_factors, tform_augment, target_shapes):
    """
    scale is a DOWNSCALING factor.
    """
    tform_center, tform_uncenter = build_center_uncenter_transforms(img.shape)
    tform_augment = tform_uncenter + tform_augment + tform_center # shift to center, augment, shift back (for the rotation/shearing)

    output = []
    for scale, target_shape in zip(scale_factors, target_shapes):
        if isinstance(scale, skimage.transform.ProjectiveTransform):
            tform_rescale = scale
        else:
            tform_rescale = build_rescale_transform(scale, img.shape, target_shape) # also does centering
        output.append(fast_warp(img, tform_rescale + tform_augment, output_shape=target_shape, mode='constant').astype('float32'))

    return output
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号