(
input_size,
is_training=False,
use_prefetcher=False,
no_aug=False,
scale=None,
ratio=None,
hflip=0.5,
vflip=0.,
color_jitter=0.4,
auto_augment=None,
interpolation='bilinear',
mean=IMAGENET_DEFAULT_MEAN,
std=IMAGENET_DEFAULT_STD,
re_prob=0.,
re_mode='const',
re_count=1,
re_num_splits=0,
crop_pct=None,
tf_preprocessing=False,
separate=False)
| 165 | |
| 166 | |
| 167 | def create_transform( |
| 168 | input_size, |
| 169 | is_training=False, |
| 170 | use_prefetcher=False, |
| 171 | no_aug=False, |
| 172 | scale=None, |
| 173 | ratio=None, |
| 174 | hflip=0.5, |
| 175 | vflip=0., |
| 176 | color_jitter=0.4, |
| 177 | auto_augment=None, |
| 178 | interpolation='bilinear', |
| 179 | mean=IMAGENET_DEFAULT_MEAN, |
| 180 | std=IMAGENET_DEFAULT_STD, |
| 181 | re_prob=0., |
| 182 | re_mode='const', |
| 183 | re_count=1, |
| 184 | re_num_splits=0, |
| 185 | crop_pct=None, |
| 186 | tf_preprocessing=False, |
| 187 | separate=False): |
| 188 | |
| 189 | if isinstance(input_size, (tuple, list)): |
| 190 | img_size = input_size[-2:] |
| 191 | else: |
| 192 | img_size = input_size |
| 193 | |
| 194 | if tf_preprocessing and use_prefetcher: |
| 195 | assert not separate, "Separate transforms not supported for TF preprocessing" |
| 196 | from .tf_preprocessing import TfPreprocessTransform |
| 197 | transform = TfPreprocessTransform( |
| 198 | is_training=is_training, size=img_size, interpolation=interpolation) |
| 199 | else: |
| 200 | if is_training and no_aug: |
| 201 | assert not separate, "Cannot perform split augmentation with no_aug" |
| 202 | transform = transforms_noaug_train( |
| 203 | img_size, |
| 204 | interpolation=interpolation, |
| 205 | use_prefetcher=use_prefetcher, |
| 206 | mean=mean, |
| 207 | std=std) |
| 208 | elif is_training: |
| 209 | transform = transforms_imagenet_train( |
| 210 | img_size, |
| 211 | scale=scale, |
| 212 | ratio=ratio, |
| 213 | hflip=hflip, |
| 214 | vflip=vflip, |
| 215 | color_jitter=color_jitter, |
| 216 | auto_augment=auto_augment, |
| 217 | interpolation=interpolation, |
| 218 | use_prefetcher=use_prefetcher, |
| 219 | mean=mean, |
| 220 | std=std, |
| 221 | re_prob=re_prob, |
| 222 | re_mode=re_mode, |
| 223 | re_count=re_count, |
| 224 | re_num_splits=re_num_splits, |
no test coverage detected