MCPcopy Create free account
hub / github.com/XLearning-SCU/2022-CVPR-DART / __call__

Method __call__

data_loader.py:23–44  ·  view source on GitHub ↗
(self, img)

Source from the content-addressed store, hash-verified

21 self.gray = gray
22
23 def __call__(self, img):
24
25 idx = random.randint(0, self.gray)
26
27 if idx == 0:
28 # random select R Channel
29 img[1, :, :] = img[0, :, :]
30 img[2, :, :] = img[0, :, :]
31 elif idx == 1:
32 # random select B Channel
33 img[0, :, :] = img[1, :, :]
34 img[2, :, :] = img[1, :, :]
35 elif idx == 2:
36 # random select G Channel
37 img[0, :, :] = img[2, :, :]
38 img[1, :, :] = img[2, :, :]
39 else:
40 tmp_img = 0.2989 * img[0, :, :] + 0.5870 * img[1, :, :] + 0.1140 * img[2, :, :]
41 img[0, :, :] = tmp_img
42 img[1, :, :] = tmp_img
43 img[2, :, :] = tmp_img
44 return img
45
46
47class SYSUData(data.Dataset):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected