From b83da15d27bf6634753c228c8fd373f1e77bb8dc Mon Sep 17 00:00:00 2001 From: gaotingquan Date: Thu, 13 Oct 2022 04:28:34 +0000 Subject: [PATCH] support set shuffle by config --- ppcls/data/dataloader/multi_scale_sampler.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ppcls/data/dataloader/multi_scale_sampler.py b/ppcls/data/dataloader/multi_scale_sampler.py index 57b42b30..9e147f01 100644 --- a/ppcls/data/dataloader/multi_scale_sampler.py +++ b/ppcls/data/dataloader/multi_scale_sampler.py @@ -15,6 +15,7 @@ class MultiScaleSampler(Sampler): first_bs, divided_factor=32, is_training=True, + shuffle=True, seed=None): """ multi scale samper @@ -23,7 +24,7 @@ class MultiScaleSampler(Sampler): scales(list): several scales for image resolution first_bs(int): batch size for the first scale in scales divided_factor(int): ImageNet models down-sample images by a factor, ensure that width and height dimensions are multiples are multiple of devided_factor. - is_training(boolean): mode + is_training(boolean): mode """ # min. and max. spatial dimensions self.data_source = data_source @@ -47,7 +48,7 @@ class MultiScaleSampler(Sampler): math.ceil(self.n_data_samples * 1.0 / num_replicas)) img_indices = [idx for idx in range(self.n_data_samples)] - self.shuffle = False + self.shuffle = shuffle if is_training: # compute the spatial dimensions and corresponding batch size # ImageNet models down-sample images by a factor of 32. @@ -66,7 +67,6 @@ class MultiScaleSampler(Sampler): batch_size = int(max(1, (base_elements / (h * w)))) img_batch_pairs.append((w, h, batch_size)) self.img_batch_pairs = img_batch_pairs - self.shuffle = True else: self.img_batch_pairs = [(base_im_w, base_im_h, base_batch_size)] -- GitLab