| 600 | |
| 601 | |
| 602 | class 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 | |
| 625 | class DetectionTransform(AbstractTransform): |