Commit 0e5299bb authored by Yuxin Wu's avatar Yuxin Wu

[imgaug] check xrange==yrange only when using ratio (fix #628)

parent fe049874
...@@ -121,15 +121,17 @@ class RandomResize(TransformAugmentorBase): ...@@ -121,15 +121,17 @@ class RandomResize(TransformAugmentorBase):
""" """
super(RandomResize, self).__init__() super(RandomResize, self).__init__()
assert aspect_ratio_thres >= 0 assert aspect_ratio_thres >= 0
if aspect_ratio_thres == 0:
assert xrange == yrange
self._init(locals()) self._init(locals())
def is_float(tp): def is_float(tp):
return isinstance(tp[0], float) or isinstance(tp[1], float) return isinstance(tp[0], float) or isinstance(tp[1], float)
assert is_float(xrange) == is_float(yrange), "xrange and yrange has different type!" assert is_float(xrange) == is_float(yrange), "xrange and yrange has different type!"
self._is_scale = is_float(xrange) self._is_scale = is_float(xrange)
if self._is_scale and aspect_ratio_thres == 0:
assert xrange == yrange
def _get_augment_params(self, img): def _get_augment_params(self, img):
cnt = 0 cnt = 0
h, w = img.shape[:2] h, w = img.shape[:2]
......
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