def add_bw(gan, config, net):
x = gan.inputs.x
s = [int(x) for x in net.get_shape()]
print("S IS ", s)
shape = [s[1], s[2]]
x = tf.image.resize_images(x, shape, 1)
bwnet = tf.slice(net, [0, 0, 0, 0], [s[0],s[1],s[2], 3])
if not gan.config.add_full_image:
print( "[colorizer] Adding black and white image", x)
x = tf.image.rgb_to_grayscale(x)
if config.colorizer_noise is not None:
x += tf.random_normal(x.get_shape(), mean=0, stddev=config.colorizer_noise, dtype=tf.float32)
#bwnet = tf.image.rgb_to_grayscale(bwnet)
#x = tf.concat(axis=3, values=[x, bwnet])
else:
print( "[colorizer] Adding full image", x)
return x
评论列表
文章目录