Repository: incubator-singa Updated Branches: refs/heads/master e67bda938 -> 63c6ae17c
fix a bug which calls randint with empty range Project: http://git-wip-us.apache.org/repos/asf/incubator-singa/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-singa/commit/63c6ae17 Tree: http://git-wip-us.apache.org/repos/asf/incubator-singa/tree/63c6ae17 Diff: http://git-wip-us.apache.org/repos/asf/incubator-singa/diff/63c6ae17 Branch: refs/heads/master Commit: 63c6ae17c62df60fb3f1cad8581edad93cbf0048 Parents: e67bda9 Author: Wei Wang <[email protected]> Authored: Thu Jul 13 13:44:43 2017 +0800 Committer: Wei Wang <[email protected]> Committed: Thu Jul 13 13:44:43 2017 +0800 ---------------------------------------------------------------------- python/singa/image_tool.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-singa/blob/63c6ae17/python/singa/image_tool.py ---------------------------------------------------------------------- diff --git a/python/singa/image_tool.py b/python/singa/image_tool.py index 687fd1a..91ec35e 100644 --- a/python/singa/image_tool.py +++ b/python/singa/image_tool.py @@ -453,10 +453,7 @@ class ImageTool(): aspect_ratio = random.uniform(3. / 4, 4. / 3) crop_x = int(round(math.sqrt(target_area * aspect_ratio))) crop_y = int(round(math.sqrt(target_area / aspect_ratio))) - assert img.size[0] >= patch[0] and img.size[1] >= patch[1],\ - 'img size (%d, %d), patch size (%d, %d)' % \ - (img.size[0], img.size[1], patch[0], patch[1]) - if img.size[0] >= crop_x and img.size[1] >= crop_y: + if img.size[0] > crop_x and img.size[1] > crop_y: left_offset = random.randint(0, img.size[0] - crop_x) top_offset = random.randint(0, img.size[1] - crop_y) box = (left_offset, top_offset, left_offset + crop_x,
