提交 fdc40d1e 编写于 作者: S shippingwang

fix

上级 bb622b24
...@@ -46,7 +46,7 @@ TRAIN: ...@@ -46,7 +46,7 @@ TRAIN:
channel_first: False channel_first: False
- RandCropImage: - RandCropImage:
size: 224 size: 224
#interpolation: 2 interpolation: 2
- RandFlipImage: - RandFlipImage:
flip_code: 1 flip_code: 1
- AutoAugment: - AutoAugment:
......
...@@ -117,7 +117,9 @@ class CropImage(object): ...@@ -117,7 +117,9 @@ class CropImage(object):
class RandCropImage(object): class RandCropImage(object):
""" random crop image """ """ random crop image """
def __init__(self, size, scale=None, ratio=None): def __init__(self, size, scale=None, ratio=None, interpolation=-1):
self.interpolation = interpolation if interpolation >= 0 else None
if type(size) is int: if type(size) is int:
self.size = (size, size) # (h, w) self.size = (size, size) # (h, w)
else: else:
...@@ -151,7 +153,10 @@ class RandCropImage(object): ...@@ -151,7 +153,10 @@ class RandCropImage(object):
j = random.randint(0, img_h - h) j = random.randint(0, img_h - h)
img = img[j:j + h, i:i + w, :] img = img[j:j + h, i:i + w, :]
return cv2.resize(img, size) if self.interpolation is None:
return cv2.resize(img, size)
else:
return cv2.resize(img, size, interpolation=self.interpolation)
class RandFlipImage(object): class RandFlipImage(object):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册