pystiche_papers.gatys_ecker_bethge_2016
Title |
Image Style Transfer Using Convolutional Neural Networks |
Authors |
Leon A. Gatys, Alexander. S. Ecker, and Matthias Bethge |
Citation |
[GEB2016] |
Reference implementation |
|
Variant |
Image optimization |
Content loss |
|
Style loss |
Behavioral changes
See also
The following parts are affected:
Hyper parameters
See also
Empty cells mean, that the parameter is not defined in the paper or no default is set in the reference implementation of the original authors. In both cases the available value is used as default.
content_loss()
Parameter |
|
|
---|---|---|
|
|
|
|
|
|
|
|
style_loss()
Parameter |
|
||
---|---|---|---|
|
|
||
|
|
||
|
|
|
|
|
|
nst()
Parameter |
|
|
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
- 1
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()
.- 2
The paper also reports
score_weight=1e-4
for some images.
API
- pystiche_papers.gatys_ecker_bethge_2016.images()
- Return type
- class pystiche_papers.gatys_ecker_bethge_2016.FeatureReconstructionLoss(encoder, impl_params=True, **feature_reconstruction_loss_kwargs)
Feature reconstruction loss from [GEB2016].
- Parameters
encoder (
Encoder
) – Encoder used to encode the input.impl_params (
bool
) – IfFalse
, calculate the score with the squared error (SE) instead of the mean squared error (MSE). Furthermore, use a score correction factor of 1/2.**feature_reconstruction_loss_kwargs – Additional parameters of a
pystiche.loss.FeatureReconstructionLoss
.
- pystiche_papers.gatys_ecker_bethge_2016.content_loss(impl_params=True, multi_layer_encoder=None, hyper_parameters=None)
Content loss from [GEB2016].
- 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
]) – Pretrained multi-layer encoder. If omitted,multi_layer_encoder()
is used.hyper_parameters (
Optional
[HyperParameters
]) – Hyper parameters. If omitted,hyper_parameters()
is used.
- Return type
- class pystiche_papers.gatys_ecker_bethge_2016.MultiLayerEncodingLoss(multi_layer_encoder, layers, encoding_loss_fn, impl_params=True, **multi_layer_encoding_op_kwargs)
Multi-layer encoding loss from [GEB2016].
- Parameters
multi_layer_encoder (
MultiLayerEncoder
) – Multi-layer encoder.layers (
Sequence
[str
]) – Layers of themulti_layer_encoder
that the children losses operate on.encoding_loss_fn (
Callable
[[Encoder
,float
],Loss
]) – Callable that returns a children loss given apystiche.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_ecker_bethge_2016.style_loss(impl_params=True, multi_layer_encoder=None, hyper_parameters=None)
Style loss from [GEB2016].
- 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
]) – Pretrained multi-layer encoder. If omitted,multi_layer_encoder()
is used.hyper_parameters (
Optional
[HyperParameters
]) – Hyper parameters. If omitted,hyper_parameters()
is used.
- Return type
- pystiche_papers.gatys_ecker_bethge_2016.perceptual_loss(impl_params=True, multi_layer_encoder=None, hyper_parameters=None)
Perceptual loss from [GEB2016].
- 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
]) – Pretrained multi-layer encoder. If omitted,multi_layer_encoder()
is used.hyper_parameters (
Optional
[HyperParameters
]) – Hyper parameters. If omitted,hyper_parameters()
is used.
See also
- Return type
- pystiche_papers.gatys_ecker_bethge_2016.nst(content_image, style_image, impl_params=True, hyper_parameters=None, quiet=False)
NST from [GEB2016].
- 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
, no information is logged during the optimization. Defaults toFalse
.
- Return type
- pystiche_papers.gatys_ecker_bethge_2016.optimizer(input_image)
Optimizer from [GEB2016].
- pystiche_papers.gatys_ecker_bethge_2016.multi_layer_encoder(impl_params=True)
Multi-layer encoder from [GEB2016].
- pystiche_papers.gatys_ecker_bethge_2016.compute_layer_weights(layers, multi_layer_encoder=None)
- pystiche_papers.gatys_ecker_bethge_2016.hyper_parameters(impl_params=True)
Hyper parameters from [GEB2016].
- Return type