Take two random crops of one image as the query and key.
| 30 | |
| 31 | |
| 32 | class TwoCropsTransform: |
| 33 | """Take two random crops of one image as the query and key.""" |
| 34 | |
| 35 | def __init__(self, base_transform): |
| 36 | self.base_transform = base_transform |
| 37 | |
| 38 | def __call__(self, x): |
| 39 | q = self.base_transform(x) |
| 40 | k = self.base_transform(x) |
| 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.""" |
no outgoing calls
no test coverage detected