本文整理汇总了Python中nets.cyclegan.cyclegan_generator_resnet方法的典型用法代码示例。如果您正苦于以下问题:Python cyclegan.cyclegan_generator_resnet方法的具体用法?Python cyclegan.cyclegan_generator_resnet怎么用?Python cyclegan.cyclegan_generator_resnet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nets.cyclegan
的用法示例。
在下文中一共展示了cyclegan.cyclegan_generator_resnet方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _select_network
# 需要导入模块: from nets import cyclegan [as 别名]
# 或者: from nets.cyclegan import cyclegan_generator_resnet [as 别名]
def _select_network(self):
get_noise_shape = None
if FLAGS.generator_network == 'pggan':
generator_network_fn = pggan.generator
discriminator_network_fn = pggan.discriminator
get_noise_shape = pggan.get_noise_shape
elif FLAGS.generator_network == 'cyclegan':
generator_network_fn = cyclegan.cyclegan_generator_resnet
discriminator_network_fn = cyclegan_dis.cyclegan_discriminator_resnet
else:
raise NotImplementedError('Generator network %s is not implemented.', FLAGS.generator_network)
return {'generator_network_fn': generator_network_fn,
'discriminator_network_fn': discriminator_network_fn,
'get_noise_shape': get_noise_shape, }
####################
# Define the model #
####################
示例2: _input_and_output_same_shape_helper
# 需要导入模块: from nets import cyclegan [as 别名]
# 或者: from nets.cyclegan import cyclegan_generator_resnet [as 别名]
def _input_and_output_same_shape_helper(self, kernel_size):
img_batch = tf.placeholder(tf.float32, shape=[None, 32, 32, 3])
output_img_batch, _ = cyclegan.cyclegan_generator_resnet(
img_batch, kernel_size=kernel_size)
self.assertAllEqual(img_batch.shape.as_list(),
output_img_batch.shape.as_list())
示例3: test_generator_inference
# 需要导入模块: from nets import cyclegan [as 别名]
# 或者: from nets.cyclegan import cyclegan_generator_resnet [as 别名]
def test_generator_inference(self):
"""Check one inference step."""
img_batch = tf.zeros([2, 32, 32, 3])
model_output, _ = cyclegan.cyclegan_generator_resnet(img_batch)
with self.test_session() as sess:
sess.run(tf.global_variables_initializer())
sess.run(model_output)
示例4: _test_generator_graph_helper
# 需要导入模块: from nets import cyclegan [as 别名]
# 或者: from nets.cyclegan import cyclegan_generator_resnet [as 别名]
def _test_generator_graph_helper(self, shape):
"""Check that generator can take small and non-square inputs."""
output_imgs, _ = cyclegan.cyclegan_generator_resnet(tf.ones(shape))
self.assertAllEqual(shape, output_imgs.shape.as_list())
示例5: test_generator_unknown_batch_dim
# 需要导入模块: from nets import cyclegan [as 别名]
# 或者: from nets.cyclegan import cyclegan_generator_resnet [as 别名]
def test_generator_unknown_batch_dim(self):
"""Check that generator can take unknown batch dimension inputs."""
img = tf.placeholder(tf.float32, shape=[None, 32, None, 3])
output_imgs, _ = cyclegan.cyclegan_generator_resnet(img)
self.assertAllEqual([None, 32, None, 3], output_imgs.shape.as_list())
示例6: _error_if_height_not_multiple_of_four_helper
# 需要导入模块: from nets import cyclegan [as 别名]
# 或者: from nets.cyclegan import cyclegan_generator_resnet [as 别名]
def _error_if_height_not_multiple_of_four_helper(self, height):
self.assertRaisesRegexp(
ValueError,
'The input height must be a multiple of 4.',
cyclegan.cyclegan_generator_resnet,
tf.placeholder(tf.float32, shape=[None, height, 32, 3]))