From dab8ab8a8f639671f551e73a1b4a2bf94a8f9302 Mon Sep 17 00:00:00 2001 From: James Betker Date: Sun, 20 Sep 2020 11:59:31 -0600 Subject: [PATCH] Offer option to configure the size of the normal distribution that the target size is drawn from --- codes/data/full_image_dataset.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/codes/data/full_image_dataset.py b/codes/data/full_image_dataset.py index 5f9e9c92..cf2fe8a1 100644 --- a/codes/data/full_image_dataset.py +++ b/codes/data/full_image_dataset.py @@ -97,7 +97,12 @@ class FullImageDataset(data.Dataset): target_sz = self.opt['min_tile_size'] h, w, _ = image.shape possible_sizes_above_target = h - target_sz - square_size = int(target_sz + possible_sizes_above_target * min(np.abs(np.random.normal(scale=.17)), 1.0)) + if 'fixed_size' in self.opt.keys() and self.opt['fixed_size']: + square_size = target_sz + else: + tile_expansion_dev = self.opt['tile_scale_normal_stddev'] if 'tile_scale_normal_stddev' in self.opt.keys() else .17 + square_size = int(target_sz + possible_sizes_above_target * min(np.abs(np.random.normal(scale=tile_expansion_dev)), 1.0)) + # Pick the left,top coords to draw the patch from left = self.pick_along_range(w, square_size, .3) top = self.pick_along_range(w, square_size, .3)