| 264 | |
| 265 | |
| 266 | def build_transform_for_linear_probe(is_train, config): |
| 267 | # linear probe: weak augmentation |
| 268 | if is_train: |
| 269 | transform = transforms.Compose([ |
| 270 | transforms.RandomResizedCrop( |
| 271 | config.DATA.IMG_SIZE, interpolation=transforms.InterpolationMode.BICUBIC), |
| 272 | transforms.RandomHorizontalFlip(), |
| 273 | transforms.ToTensor(), |
| 274 | transforms.Normalize(mean=config.AUG.MEAN, std=config.AUG.STD) |
| 275 | ]) |
| 276 | else: |
| 277 | transform = transforms.Compose([ |
| 278 | transforms.Resize( |
| 279 | config.DATA.IMG_SIZE, interpolation=transforms.InterpolationMode.BICUBIC), |
| 280 | transforms.CenterCrop(config.DATA.IMG_SIZE), |
| 281 | transforms.ToTensor(), |
| 282 | transforms.Normalize(mean=config.AUG.MEAN, std=config.AUG.STD) |
| 283 | ]) |
| 284 | return transform |
| 285 | |
| 286 | |
| 287 | def build_transform(is_train, config): |