相同的数据量,patchsize 不一样,检测一下patchsize 对模型的影响
patchsize=48 高分辨率图像
import argparse
import glob
import h5py
import numpy as np
import PIL.Image as pil_image
from utils import calc_patch_size, convert_rgb_to_y
from PIL import Image
import random
def random_crop(image, crop_shape):
nw = random.randint(0, image.size[0] - crop_shape[0]) ##裁剪图像在原图像中的坐标
nh = random.randint(0, image.size[1] - crop_shape[1])
image_crop = image.crop((nh, nw, nh + crop_shape[0], nw + crop_shape[1]))
return image_crop
def train(args):
h5_file = h5py.File(args.output_path, 'w')
lr_patches = []
hr_patches = []
flip = [0,1,2]
count = 1
for image_path in sorted(glob.glob('{}/*'.format(args.images_dir))):
hr = pil_image.open(image_path).convert('RGB')
hr_images = []
if args.with_aug:
for s in [1.0,0.8,0.9