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)
评论列表
文章目录