Skip to content

Commit ec4c3ed

Browse files
committed
make preprocessing order more consistent(same result as before)
1 parent 20f9ee2 commit ec4c3ed

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

utils/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ def aspectaware_resize_padding(image, width, height, interpolation=None, means=N
6565
return canvas, new_w, new_h, old_w, old_h, padding_w, padding_h,
6666

6767

68-
def preprocess(*image_path, max_size=512, mean=(0.406, 0.456, 0.485), std=(0.225, 0.224, 0.229)):
69-
ori_imgs = [cv2.imread(img_path) for img_path in image_path]
68+
def preprocess(*image_path, max_size=512, mean=(0.485, 0.456, 0.406), std=(0.229, 0.224, 0.225)):
69+
ori_imgs = [cv2.imread(img_path)[..., ::-1] for img_path in image_path]
7070
normalized_imgs = [(img / 255 - mean) / std for img in ori_imgs]
71-
imgs_meta = [aspectaware_resize_padding(img[..., ::-1], max_size, max_size,
71+
imgs_meta = [aspectaware_resize_padding(img, max_size, max_size,
7272
means=None) for img in normalized_imgs]
7373
framed_imgs = [img_meta[0] for img_meta in imgs_meta]
7474
framed_metas = [img_meta[1:] for img_meta in imgs_meta]

0 commit comments

Comments
 (0)