Commit 538d87b1 authored by Sasank Chilamkurthy's avatar Sasank Chilamkurthy
Browse files

Fix a bug in randomsizedcrop

parent f4ddc924
...@@ -245,6 +245,7 @@ def scaled_crop(img, x, y, w, h, size, interpolation=Image.BILINEAR): ...@@ -245,6 +245,7 @@ def scaled_crop(img, x, y, w, h, size, interpolation=Image.BILINEAR):
assert _is_pil_image(img), 'img should be PIL Image' assert _is_pil_image(img), 'img should be PIL Image'
img = crop(img, x, y, w, h) img = crop(img, x, y, w, h)
img = scale(img, size, interpolation) img = scale(img, size, interpolation)
return img
def hflip(img): def hflip(img):
...@@ -552,12 +553,12 @@ class RandomSizedCrop(object): ...@@ -552,12 +553,12 @@ class RandomSizedCrop(object):
This is popularly used to train the Inception networks. This is popularly used to train the Inception networks.
Args: Args:
size: size of the smaller edge size: expected output size of each edge
interpolation: Default: PIL.Image.BILINEAR interpolation: Default: PIL.Image.BILINEAR
""" """
def __init__(self, size, interpolation=Image.BILINEAR): def __init__(self, size, interpolation=Image.BILINEAR):
self.size = size self.size = (size, size)
self.interpolation = interpolation self.interpolation = interpolation
@staticmethod @staticmethod
...@@ -566,7 +567,6 @@ class RandomSizedCrop(object): ...@@ -566,7 +567,6 @@ class RandomSizedCrop(object):
Args: Args:
img (PIL.Image): Image to be cropped. img (PIL.Image): Image to be cropped.
output_size (tuple): Expected output size of the crop.
Returns: Returns:
tuple: params (x, y, w, h) to be passed to ``crop`` for a random tuple: params (x, y, w, h) to be passed to ``crop`` for a random
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment