Skip to content
Snippets Groups Projects
Unverified Commit a3c8ddf7 authored by Kai Chen's avatar Kai Chen Committed by GitHub
Browse files

Merge pull request #391 from hellock/master

allow specifying multi-scale random mode
parents 189d6097 4bb293dd
No related branches found
No related tags found
No related merge requests found
......@@ -40,6 +40,7 @@ class CustomDataset(Dataset):
img_prefix,
img_scale,
img_norm_cfg,
multiscale_mode='value',
size_divisor=None,
proposal_file=None,
num_max_proposals=1000,
......@@ -73,6 +74,10 @@ class CustomDataset(Dataset):
# normalization configs
self.img_norm_cfg = img_norm_cfg
# multi-scale mode (only applicable for multi-scale training)
self.multiscale_mode = multiscale_mode
assert multiscale_mode in ['value', 'range']
# max proposals per image
self.num_max_proposals = num_max_proposals
# flip ratio
......@@ -196,7 +201,8 @@ class CustomDataset(Dataset):
# apply transforms
flip = True if np.random.rand() < self.flip_ratio else False
img_scale = random_scale(self.img_scales) # sample a scale
# randomly sample a scale
img_scale = random_scale(self.img_scales, self.multiscale_mode)
img, img_shape, pad_shape, scale_factor = self.img_transform(
img, img_scale, flip, keep_ratio=self.resize_keep_ratio)
img = img.copy()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment