本文整理匯總了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]))