load.py 文件源码

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

项目:carvana-challenge 作者: chplushsieh 项目源码 文件源码
def load_train_image(data_dir, img_name,
                     is_hflip=False, hshift=0, vshift=0, rotate=0, scale_size=0,
                     is_color_trans=False, is_fancy_pca_trans=False, is_edge_enh_trans=False,
                     test_time_aug=None, paddings=None, tile_size=None):
    '''
    load a train image
    '''
    img_file_name = tile.get_img_name(img_name)
    img_ext = 'jpg'
    img = load_image_file(data_dir, img_file_name, img_ext, rotate)
    # img.shape: (height, width, 3)

    if is_color_trans :
        img = color.transform(img)
    if is_fancy_pca_trans:
        img = fancy_pca.rgb_shift(img)
    if is_edge_enh_trans:
        img = cv2.detailEnhance(img, sigma_s=5, sigma_r=0.1)

    img = np.moveaxis(img, 2, 0)
    # img.shape: (3, height, width)

    return preprocess(img, img_name, is_hflip, hshift, vshift, scale_size, paddings, tile_size, test_time_aug)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号