MCPcopy Create free account
hub / github.com/apple/ml-4m / TokTransform

Class TokTransform

fourm/data/modality_transforms.py:602–622  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

600
601
602class TokTransform(AbstractTransform):
603
604 def __init__(self):
605 pass
606
607 def load(self, path):
608 sample = np.load(path).astype(int)
609 return sample
610
611 def preprocess(self, sample):
612 return sample
613
614 def image_augment(self, v, crop_coords: Tuple, flip: bool, orig_size: Tuple, target_size: Tuple,
615 rand_aug_idx: Optional[int], resample_mode: str = None):
616 if rand_aug_idx is None:
617 raise ValueError("Crop settings / augmentation index are missing but a pre-tokenized modality is being used")
618 v = torch.tensor(v[rand_aug_idx])
619 return v
620
621 def postprocess(self, sample):
622 return sample
623
624
625class DetectionTransform(AbstractTransform):

Callers 1

modality_info.pyFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected