(input_image, which_styles, output_dir)
Stylizes image into a linear combination of styles and writes to disk.
Stylizes image into a linear combination of styles and writes to disk.
Stylizes image into a linear combination of styles and writes to disk .
def _multiple_styles(input_image, which_styles, output_dir):
  """Stylizes image into a linear combination of styles and writes to disk."""
  with tf.Graph().as_default(), tf.Session() as sess:
    mixture = _style_mixture(which_styles, FLAGS.num_styles)
    stylized_images = model.transform(
        input_image,
        alpha=FLAGS.alpha,
        normalizer_fn=ops.weighted_instance_norm,
        normalizer_params={
            'weights': tf.constant(mixture),
            'num_categories': FLAGS.num_styles,
            'center': True,
            'scale': True
        })
    _load_checkpoint(sess, FLAGS.checkpoint)

    stylized_image = stylized_images.eval()
    image_utils.save_np_image(
        stylized_image,
        os.path.join(output_dir, '%s_%s.png' % (
            FLAGS.output_basename, _describe_style(which_styles))))
def _multiple_styles ( input_image , which_styles , output_dir ) : with tf . Graph ( ) . as_default ( ) , tf . Session ( ) as sess : mixture = _style_mixture ( which_styles , FLAGS . num_styles ) stylized_images = model . transform ( input_image , alpha = FLAGS . alpha , normalizer_fn = ops . weighted_instance_norm , normalizer_params = { 'weights' : tf . constant ( mixture ) , 'num_categories' : FLAGS . num_styles , 'center' : True , 'scale' : True } ) _load_checkpoint ( sess , FLAGS . checkpoint ) stylized_image = stylized_images . eval ( ) image_utils . save_np_image ( stylized_image , os . path . join ( output_dir , '%s_%s.png' % ( FLAGS . output_basename , _describe_style ( which_styles ) ) ) )