MCPcopy Create free account
hub / github.com/TPCD/DCCL / ContrastiveLearningViewGenerator

Class ContrastiveLearningViewGenerator

methods/partitioning/subset_len.py:31–39  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

29warnings.filterwarnings("ignore", category=DeprecationWarning)
30
31class ContrastiveLearningViewGenerator(object):
32 """Take two random crops of one image as the query and key."""
33
34 def __init__(self, base_transform, n_views=2):
35 self.base_transform = base_transform
36 self.n_views = n_views
37
38 def __call__(self, x):
39 return [self.base_transform(x) for i in range(self.n_views)]
40
41
42if __name__ == "__main__":

Callers 1

subset_len.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected