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

Method __call__

pycontrast/datasets/util.py:38–47  ·  view source on GitHub ↗
(self, img)

Source from the content-addressed store, hash-verified

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)
40 r_y = np.random.randint(0, self.side + 1, self.n_grid * self.n_grid)
41 img = np.asarray(img, np.uint8)
42 crops = []
43 for i in range(self.n_grid * self.n_grid):
44 crops.append(img[self.xx[i] + r_x[i]: self.xx[i] + r_x[i] + self.crop_size,
45 self.yy[i] + r_y[i]: self.yy[i] + r_y[i] + self.crop_size, :])
46 crops = [Image.fromarray(crop) for crop in crops]
47 return crops
48
49
50class Rotate(object):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected