This commit is contained in:
Glenn Jocher 2019-12-08 13:04:40 -08:00
parent f373764e4d
commit 638ecbe894
1 changed files with 2 additions and 2 deletions

View File

@ -677,8 +677,8 @@ def random_affine(img, targets=(), degrees=10, translate=.1, scale=.1, shear=10,
# xy = np.concatenate((x - w / 2, y - h / 2, x + w / 2, y + h / 2)).reshape(4, n).T
# reject warped points outside of image
np.clip(xy[:, [0, 2]], 0, width, out=xy[:, [0, 2]])
np.clip(xy[:, [1, 3]], 0, height, out=xy[:, [1, 3]])
xy[:, [0, 2]] = xy[:, [0, 2]].clip(0, width)
xy[:, [1, 3]] = xy[:, [1, 3]].clip(0, height)
w = xy[:, 2] - xy[:, 0]
h = xy[:, 3] - xy[:, 1]
area = w * h