MCPcopy
hub / github.com/junyanz/iGAN / transform_im

Function transform_im

lib/AlexNet.py:140–151  ·  view source on GitHub ↗
(x, npx=64, nc=3)

Source from the content-addressed store, hash-verified

138
139
140def transform_im(x, npx=64, nc=3):
141 if nc == 3:
142 x1 = (x + sharedX(1.0)) * sharedX(127.5)
143 else:
144 x1 = T.tile(x, [1, 1, 1, 3]) * sharedX(255.0) # [hack] to-be-tested
145
146 mean_channel = np.load(os.path.join(pkg_dir, 'ilsvrc_2012_mean.npy')).mean(1).mean(1)
147 mean_im = mean_channel[np.newaxis, :, np.newaxis, np.newaxis]
148 mean_im = floatX(np.tile(mean_im, [1, 1, npx, npx]))
149 x2 = x1[:, [2, 1, 0], :, :]
150 y = x2 - mean_im
151 return y

Callers

nothing calls this directly

Calls 2

sharedXFunction · 0.90
floatXFunction · 0.90

Tested by

no test coverage detected