MCPcopy Create free account
hub / github.com/HobbitLong/PyContrast / __init__

Method __init__

pycontrast/datasets/util.py:27–36  ·  view source on GitHub ↗
(self, n_grid=3, img_size=255, crop_size=64)

Source from the content-addressed store, hash-verified

25class JigsawCrop(object):
26 """Jigsaw style crop"""
27 def __init__(self, n_grid=3, img_size=255, crop_size=64):
28 self.n_grid = n_grid
29 self.img_size = img_size
30 self.crop_size = crop_size
31 self.grid_size = int(img_size / self.n_grid)
32 self.side = self.grid_size - self.crop_size
33
34 yy, xx = np.meshgrid(np.arange(n_grid), np.arange(n_grid))
35 self.yy = np.reshape(yy * self.grid_size, (n_grid * n_grid,))
36 self.xx = np.reshape(xx * self.grid_size, (n_grid * n_grid,))
37
38 def __call__(self, img):
39 r_x = np.random.randint(0, self.side + 1, self.n_grid * self.n_grid)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected