def train_jitter(self, img, w=None, h=None, f=None, s=None):
if w is None:
w = random.randint(224, 250)
if h is None:
h = w
if f is None:
f = random.choice([True, False])
if s is None:
s = random.choice([False, 0, 1])
img = img_proc.resize(img, (w,h))
img = img_proc.crop_center(img, (224, 224))
if s is not False:
img = cv2.GaussianBlur(img, (11, 11), s)
if f:
img = img_proc.flip(img)
return img
评论列表
文章目录