From 78d0ddc8524a9d3e5e1a17c8c4b2e16cfc51f9ef Mon Sep 17 00:00:00 2001 From: Ezra-Yu <18586273+Ezra-Yu@users.noreply.github.com> Date: Tue, 11 Jul 2023 10:18:08 +0800 Subject: [PATCH] [Fix] Fix RandomCrop bug (#1706) --- mmpretrain/datasets/transforms/processing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmpretrain/datasets/transforms/processing.py b/mmpretrain/datasets/transforms/processing.py index bbc04da74ec..dfd3ed6bfb7 100644 --- a/mmpretrain/datasets/transforms/processing.py +++ b/mmpretrain/datasets/transforms/processing.py @@ -173,7 +173,7 @@ def rand_crop_params(self, img: np.ndarray): return 0, 0, h, w elif w < target_w or h < target_h: target_w = min(w, target_w) - target_h = min(w, target_h) + target_h = min(h, target_h) offset_h = np.random.randint(0, h - target_h + 1) offset_w = np.random.randint(0, w - target_w + 1)