Take two random crops of one image as the query and key.
| 41 | return torch.cat([q, k], dim=0) |
| 42 | |
| 43 | class SLIPTransform: |
| 44 | """Take two random crops of one image as the query and key.""" |
| 45 | |
| 46 | def __init__(self, base_transform, augment): |
| 47 | self.base_transform = base_transform |
| 48 | self.augment = augment |
| 49 | |
| 50 | def __call__(self, x): |
| 51 | base = self.base_transform(x) |
| 52 | q = self.augment(x) |
| 53 | # k = self.augment(x) |
| 54 | return torch.cat([base, q], dim=0) |
| 55 | |
| 56 | class CALSMultiResolutionTransform(object): |
| 57 | def __init__(self, base_transform, stronger_transfrom, num_res=5, resolutions=[96, 128, 160, 192, 224]): |
no outgoing calls
no test coverage detected