MCPcopy Create free account
hub / github.com/Meshcapade/difflocks / get_transform

Function get_transform

utils/general_util.py:551–582  ·  view source on GitHub ↗
(size=(512,512),apply_agmentationt=False,normalization=False,flip=False)

Source from the content-addressed store, hash-verified

549 return F.hflip(img)
550
551def get_transform(size=(512,512),apply_agmentationt=False,normalization=False,flip=False):
552 color_jitter = transforms.ColorJitter(
553 brightness=(0.8, 1.2),
554 contrast=(0.8,1.2),
555 saturation=(0.7,1.3),
556 hue=0.05
557 )
558 transform = []
559 if apply_agmentationt:
560 transform.append(color_jitter)
561
562 transform.append(transforms.ToTensor())
563
564 if flip:
565 transform.append(HorizontalFlip())
566
567 if apply_agmentationt:
568 transform.append(CustomCrop(crop_size=600, top_ratio=0.4, left_ratio=0.5))
569
570 transform.append(transforms.Resize(size))
571 if apply_agmentationt:
572 transform.append(transforms.RandomRotation(degrees=30))
573
574 if normalization:
575 transform.append( transforms.Normalize(
576 mean=[0.485, 0.456, 0.406],
577 std=[0.229, 0.224, 0.225]
578 ))
579
580
581 transform = transforms.Compose(transform)
582 return transform

Callers

nothing calls this directly

Calls 2

HorizontalFlipClass · 0.85
CustomCropClass · 0.85

Tested by

no test coverage detected