MCPcopy Create free account
hub / github.com/Sense-GVT/DeCLIP / SLIPTransform

Class SLIPTransform

prototype/data/transforms.py:43–54  ·  view source on GitHub ↗

Take two random crops of one image as the query and key.

Source from the content-addressed store, hash-verified

41 return torch.cat([q, k], dim=0)
42
43class 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
56class CALSMultiResolutionTransform(object):
57 def __init__(self, base_transform, stronger_transfrom, num_res=5, resolutions=[96, 128, 160, 192, 224]):

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected