Ejemplo n.º 1
0
def get_transform_2(train):
    transforms = [T.ToTensor()]
    if train:
        transforms = [
            # transforms on PIL.Image
            T.TransformsCOCO('ColorJitter',
                             brightness=0.4,
                             contrast=.4,
                             saturation=.4),
            T.RandomCropCOCOSimple(scale=(0.6, 1.3)),
            # to tensor
            T.ToTensor(),
            # transforms on  Tensor
            T.RandomApplyCOCO([T.LightingCOCO(0.1)], 0.3),
            T.RandomHorizontalFlip(0.5)
        ]
    return T.Compose(transforms)
Ejemplo n.º 2
0
def get_transform(train):
    transforms = [T.ToTensor()]
    if train:
        transforms.append(T.RandomHorizontalFlip(0.5))
    return T.Compose(transforms)