pystiche_papers.gatys_et_al_2017
Title |
Controlling Perceptual Factors in Neural Style Transfer |
Authors |
Leon A. Gatys, Alexander. S. Ecker, Matthias Bethge, Aaron Hertzmann, and Eli Shechtman |
Citation |
[GEB+2017] |
Reference implementation |
|
Variant |
Image optimization |
Content loss |
|
Style loss |
Behavioral changes
See also
The following parts are affected:
Hyper parameters
content_loss()
Parameter |
|
|
---|---|---|
|
|
|
|
|
|
|
|
style_loss()
Parameter |
|
|
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
guided_style_loss()
Parameter |
|
|
---|---|---|
|
|
|
|
|
|
|
||
|
|
|
|
|
image_pyramid()
Parameter |
|
|
---|---|---|
|
|
|
|
|
|
|
|
- 1(1,2,3,4)
The values are reported in the supplementary material.
- 2
The
layer_weights
are computed by \(1 / n^2\) where \(n\) denotes the number of channels of a feature map from the corresponding layer in themulti_layer_encoder()
.- 3
The paper only reports the
edge_size
for the low resolution.- 4
The paper only reports the ratio. i.e. \(500 / 200 = 2.5\) of
num_steps
.
API
- pystiche_papers.gatys_et_al_2017.images()
- Return type
- pystiche_papers.gatys_et_al_2017.content_loss(multi_layer_encoder=None, hyper_parameters=None)
Content_loss from [GEB+2017].
- Parameters
multi_layer_encoder (
Optional
[MultiLayerEncoder
]) – If omitted,multi_layer_encoder()
is used.hyper_parameters (
Optional
[HyperParameters
]) – If omitted,hyper_parameters()
is used.
- Return type
- class pystiche_papers.gatys_et_al_2017.MultiLayerEncodingLoss(multi_layer_encoder, layers, encoding_loss_fn, impl_params=True, **multi_layer_encoding_op_kwargs)
Multi-layer encoding Loss from [GEB+2017].
- Parameters
multi_layer_encoder (
MultiLayerEncoder
) – Multi-layer encoder.layers (
Sequence
[str
]) – Layers of themulti_layer_encoder
that the children losses operate on.get_encoding_op – Callable that returns a children Loss given a
pystiche.enc.SingleLayerEncoder
extracted from themulti_layer_encoder
and its corresponding layer weight.impl_params (
bool
) – IfFalse
, use a score correction factor of 1/4.**multi_layer_encoding_op_kwargs – Additional parameters of a
pystiche.loss.MultiLayerEncodingLoss
.
See also
- pystiche_papers.gatys_et_al_2017.style_loss(impl_params=True, multi_layer_encoder=None, hyper_parameters=None)
Style_loss from [GEB+2017].
- Parameters
impl_params (
bool
) – Switch the behavior and hyper-parameters between the reference implementation of the original authors and what is described in the paper. For details see here.multi_layer_encoder (
Optional
[MultiLayerEncoder
]) – If omitted,multi_layer_encoder()
is used.hyper_parameters (
Optional
[HyperParameters
]) – If omitted,hyper_parameters()
is used.
- Return type
- pystiche_papers.gatys_et_al_2017.guided_style_loss(regions, impl_params=True, multi_layer_encoder=None, hyper_parameters=None)
Guided style_loss from [GEB+2017].
- Parameters
regions (
Sequence
[str
]) – Regions of the input image to be stylized.impl_params (
bool
) – Switch the behavior and hyper-parameters between the reference implementation of the original authors and what is described in the paper. For details see here.multi_layer_encoder (
Optional
[MultiLayerEncoder
]) – If omitted,multi_layer_encoder()
is used.hyper_parameters (
Optional
[HyperParameters
]) – If omitted,hyper_parameters()
is used.
- Return type
- pystiche_papers.gatys_et_al_2017.perceptual_loss(impl_params=True, multi_layer_encoder=None, hyper_parameters=None)
Perceptual loss from [GEB+2017].
- Parameters
impl_params (
bool
) – Switch the behavior and hyper-parameters between the reference implementation of the original authors and what is described in the paper. For details see here.multi_layer_encoder (
Optional
[MultiLayerEncoder
]) – If omitted,multi_layer_encoder()
is used.hyper_parameters (
Optional
[HyperParameters
]) – If omitted,hyper_parameters()
is used.
- Return type
- pystiche_papers.gatys_et_al_2017.guided_perceptual_loss(regions, impl_params=True, multi_layer_encoder=None, hyper_parameters=None)
Guided perceptual loss from [GEB+2017].
- Parameters
regions (
Sequence
[str
]) – Regions of the input image to be stylized.impl_params (
bool
) – Switch the behavior and hyper-parameters between the reference implementation of the original authors and what is described in the paper. For details see here.multi_layer_encoder (
Optional
[MultiLayerEncoder
]) – If omitted,multi_layer_encoder()
is used.hyper_parameters (
Optional
[HyperParameters
]) – If omitted,hyper_parameters()
is used.
- Return type
- pystiche_papers.gatys_et_al_2017.nst(content_image, style_image, impl_params=True, hyper_parameters=None, quiet=False)
NST from [GEB+2017].
- Parameters
content_image (
Tensor
) – Content image for the NST.style_image (
Tensor
) – Style image for the NST.impl_params (
bool
) – Switch the behavior and hyper-parameters between the reference implementation of the original authors and what is described in the paper. For details see here.hyper_parameters (
Optional
[HyperParameters
]) – If omitted,hyper_parameters()
is used.quiet (
bool
) – IfTrue
, not information is logged during the optimization. Defaults toFalse
.
- Return type
- pystiche_papers.gatys_et_al_2017.guided_nst(content_image, content_guides, style_images_and_guides, impl_params=True, hyper_parameters=None, quiet=False)
Guided NST from [GEB+2017].
- Parameters
content_image (
Tensor
) – Content image for the guided NST.content_guides (
Dict
[str
,Tensor
]) – Content image guides for the guided NST.style_images_and_guides (
Dict
[str
,Tuple
[Tensor
,Tensor
]]) – Dictionary with the style images and the corresponding guides for each region.impl_params (
bool
) – Switch the behavior and hyper-parameters between the reference implementation of the original authors and what is described in the paper. For details see here.hyper_parameters (
Optional
[HyperParameters
]) – If omitted,hyper_parameters()
is used.quiet (
bool
) – IfTrue
, not information is logged during the optimization. Defaults toFalse
.
- Return type
- pystiche_papers.gatys_et_al_2017.image_pyramid(hyper_parameters=None, **image_pyramid_kwargs)
Image pyramid from [GEB+2017].
- Parameters
hyper_parameters (
Optional
[HyperParameters
]) – If omitted,hyper_parameters()
is used.**image_pyramid_kwargs – Additional parameters of a
pystiche.pyramid.ImagePyramid
.
See also
- Return type
- pystiche_papers.gatys_et_al_2017.preprocessor()
- Return type
CaffePreprocessing
- pystiche_papers.gatys_et_al_2017.postprocessor()
- Return type
CaffePostprocessing
- pystiche_papers.gatys_et_al_2017.multi_layer_encoder()
Multi-layer encoder from [GEB+2017].
- Return type
- pystiche_papers.gatys_et_al_2017.optimizer(input_image)
Optimizer from [GEB+2017].
- pystiche_papers.gatys_et_al_2017.compute_layer_weights(layers, multi_layer_encoder=None)
- pystiche_papers.gatys_et_al_2017.hyper_parameters(impl_params=True)
Hyper parameters from [GEB+2017].
- Return type