Skip to content

Commit 104e9ab

Browse files
authored
Merge pull request WZMIAOMIAO#554 from WZMIAOMIAO/dev
fix shape bug
2 parents 0f334c6 + 12c9df1 commit 104e9ab

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pytorch_object_detection/yolov3_spp/build_utils/img_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ def letterbox(img: np.ndarray,
3737
dw, dh = np.mod(dw, 64), np.mod(dh, 64) # wh padding
3838
elif scale_fill: # stretch 简单粗暴的将图片缩放到指定尺寸
3939
dw, dh = 0, 0
40-
new_unpad = new_shape
41-
ratio = new_shape[0] / shape[1], new_shape[1] / shape[0] # wh ratios
40+
new_unpad = new_shape[::-1] # [h, w] -> [w, h]
41+
ratio = new_shape[1] / shape[1], new_shape[0] / shape[0] # wh ratios
4242

4343
dw /= 2 # divide padding into 2 sides 将padding分到上下,左右两侧
4444
dh /= 2

0 commit comments

Comments
 (0)