Closed fjchange closed 4 years ago
In five_crop()
def five_crop(img, size): if isinstance(size, numbers.Number): size = (int(size), int(size)) else: assert len(size) == 2, "Please provide only two dimensions (h, w) for size." h,w = img.shape[0:2] crop_h, crop_w = size if crop_w > w or crop_h > h: raise ValueError("Requested crop size {} is bigger than input size {}".format(size, (h, w))) tl = crop(img, 0, 0, crop_h, crop_w) tr = crop(img, 0, w-crop_w, crop_h, crop_w) bl = crop(img, h - crop_h,0, crop_h, crop_w) br = crop(img, h - crop_h, w- crop_w, crop_h, crop_w) center = center_crop(img, (crop_h, crop_w)) return [tl, tr, bl, br, center]
You're exactly right, I can't believe I had a height / width mixup. I incorporated your changes in 9419213. Thank you!
In five_crop()