Merge branch 'master' into advanced_logging

This commit is contained in:
Glenn Jocher authored and GitHub committed 2020-07-08 17:01:19 -07:00
commit dc5e18390a
8 files changed
+53 -38

No files matched your search

+1 -1
View File
@@ -179,7 +179,7 @@ def xywh2xyxy(x):
def scale_coords(img1_shape, coords, img0_shape, ratio_pad=None):
# Rescale coords (xyxy) from img1_shape to img0_shape
if ratio_pad is None: # calculate from img0_shape
gain = max(img1_shape) / max(img0_shape) # gain = old / new
gain = min(img1_shape[0] / img0_shape[0], img1_shape[1] / img0_shape[1]) # gain = old / new
pad = (img1_shape[1] - img0_shape[1] * gain) / 2, (img1_shape[0] - img0_shape[0] * gain) / 2 # wh padding
else:
gain = ratio_pad[0][0]