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

Class TwoCropsTransform

prototype/data/transforms.py:32–41  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

30
31
32class 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
43class SLIPTransform:
44 """Take two random crops of one image as the query and key."""

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected