submission.py 文件源码

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

项目:u-net 作者: yihui-he 项目源码 文件源码
def augmentation(image, org_width=160,org_height=224, width=190, height=262):
    max_angle=20
    image=resize(image,(width,height))

    angle=np.random.randint(max_angle)
    if np.random.randint(2):
        angle=-angle
    image=rotate(image,angle,resize=True)

    xstart=np.random.randint(width-org_width)
    ystart=np.random.randint(height-org_height)
    image=image[xstart:xstart+org_width,ystart:ystart+org_height]

    if np.random.randint(2):
        image=cv2.flip(image,1)

    if np.random.randint(2):
        image=cv2.flip(image,0)
    # image=resize(image,(org_width,org_height))

    print(image.shape)
    plt.imshow(image)
    plt.show()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号