You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
assertsh<=heightandsw<=height, f'scaled shape {nw}x{nh} is not smaller than or equal to the required shape: {width}x{height} this is a bug:'
272
+
# get scale size, avoiding precision errors
273
+
scale_ratio=max(img_h/height, img_w/width)
274
+
scale_h=int(round(img_h/scale_ratio, 5))
275
+
scale_w=int(round(img_w/scale_ratio, 5))
276
+
assertscale_h<=heightandscale_w<=width, f'scaled shape {scale_w}x{scale_h} is not smaller than or equal to the required shape: {width}x{height} this is a bug:'
274
277
# scale image
275
-
img=scale(sw, sh, img)
276
-
nh, nw, nc=img.shape
277
-
assertnh==shandnw==sw, f'scaled shape {nw}x{nh} does not match required scaled shape: {sw}x{sh} this is a bug!'
278
+
img=scale(scale_w, scale_h, img)
278
279
# pad the image if needed
279
-
ph=height-sh
280
-
pw=width-sw
281
-
ifph!=0orpw!=0:
282
-
assertph>=0andpw>=0, f'target width={repr(width)} height={repr(width)}, pad amount: pw={repr(pw)} ph={repr(ph)}'
assertoh==heightandow==width, f'output shape {ow}x{oh} does not match required shape: {width}x{height} this is a bug!'
285
+
assertimg.shape[0] ==heightandimg.shape[1] ==width, f'output shape {img.shape[1]}x{img.shape[0]} does not match required shape: {width}x{height} this is a bug!'
0 commit comments