MCPcopy Create free account
hub / github.com/OpenGVLab/InternVL / build_transform_for_linear_probe

Function build_transform_for_linear_probe

classification/dataset/build.py:266–284  ·  view source on GitHub ↗
(is_train, config)

Source from the content-addressed store, hash-verified

264
265
266def 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
287def build_transform(is_train, config):

Callers 1

build_datasetFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected