This commit is contained in:
Glenn Jocher
2019-04-22 14:31:23 +02:00
parent 0bac735cc6
commit cf2caaad41
4 changed files with 13 additions and 11 deletions
+1 -1
View File
@@ -74,7 +74,7 @@ class LoadImages: # for inference
print('image %g/%g %s: ' % (self.count, self.nF, path), end='')
# Padded resize
img, _, _, _ = letterbox_rect(img0, height=self.height)
img, _, _, _ = letterbox(img0, height=self.height)
print('%gx%g ' % img.shape[:2], end='') # print image size
# Normalize RGB
+4 -2
View File
@@ -103,8 +103,10 @@ def xywh2xyxy(x):
def scale_coords(img1_shape, coords, img0_shape):
# Rescale coords1 (xyxy) from img1_shape to img0_shape
gain = img1_shape / max(img0_shape[:2]) # gain = old / new
pad_x = np.mod(img1_shape - img0_shape[1] * gain, 32) / 2 # width padding
pad_y = np.mod(img1_shape - img0_shape[0] * gain, 32) / 2 # height padding
# pad_x = np.mod(img1_shape - img0_shape[1] * gain, 32) / 2 # width padding
# pad_y = np.mod(img1_shape - img0_shape[0] * gain, 32) / 2 # height padding
pad_x = (img1_shape - img0_shape[1] * gain) / 2 # width padding
pad_y = (img1_shape - img0_shape[0] * gain) / 2 # height padding
coords[:, [0, 2]] -= pad_x
coords[:, [1, 3]] -= pad_y
coords[:, :4] /= gain