edflow.applications.tf_perceptual_loss module

Summary

Classes:

VGG19Features

Functions:

preprocess_input

Preprocesses a tensor encoding a batch of images.

Reference

edflow.applications.tf_perceptual_loss.preprocess_input(x)[source]

Preprocesses a tensor encoding a batch of images. :param x: input tensor, 4D in [-1,1] :type x: tf.Tenser

Returns

Preprocessed tensor

Return type

tf.Tensor

class edflow.applications.tf_perceptual_loss.VGG19Features(session, feature_layers=None, feature_weights=None, gram_weights=None, default_gram=0.1, original_scale=False)[source]

Bases: object

__init__(session, feature_layers=None, feature_weights=None, gram_weights=None, default_gram=0.1, original_scale=False)[source]

Initialize self. See help(type(self)) for accurate signature.

extract_features(x)[source]

x should be rgb in [-1,1].

make_feature_ops(x)[source]

x should be rgb tensor in [-1,1].

grams(fs)[source]
make_loss_op(x, y)[source]

x, y should be rgb tensors in [-1,1]. Uses l1 and spatial average.

make_nll_op(x, y, log_variances, gram_log_variances=None, calibrate=True)[source]

x, y should be rgb tensors in [-1,1]. This version treats every layer independently.

make_l1_nll_op(x, y, log_variance)[source]

x, y should be rgb tensors in [-1,1]. Uses make_loss_op to compute version compatible with previous experiments.

make_style_op(x, y)[source]