StyleTransfer¶
- class flash.image.style_transfer.model.StyleTransfer(style_image=None, model=None, backbone='vgg16', content_layer='relu2_2', content_weight=100000.0, style_layers=['relu1_2', 'relu2_2', 'relu3_3', 'relu4_3'], style_weight=10000000000.0, optimizer='Adam', lr_scheduler=None, learning_rate=None)[source]¶
StyleTransfer
is aTask
for transferring the style from one image onto another. For more details, see Style Transfer.- Parameters
style_image¶ (
Union
[str
,Tensor
,None
]) – Image or path to an image to derive the style from.model¶ (
Optional
[Module
]) – The model by the style transfer task.backbone¶ (
str
) – A string or model to use to compute the style loss from.content_layer¶ (
str
) – Which layer from the backbone to extract the content loss from.content_weight¶ (
float
) – The weight associated with the content loss. A lower value will lose content over style.style_layers¶ (
Union
[Sequence
[str
],str
]) – Layers from the backbone to derive the style loss from.style_weight¶ (
float
) – The weight associated with the style loss. A lower value will lose style over content.optimizer¶ (
TypeVar
(OPTIMIZER_TYPE
,str
,Callable
,Tuple
[str
,Dict
[str
,Any
]],None
)) – Optimizer to use for training.lr_scheduler¶ (
Optional
[TypeVar
(LR_SCHEDULER_TYPE
,str
,Callable
,Tuple
[str
,Dict
[str
,Any
]],Tuple
[str
,Dict
[str
,Any
],Dict
[str
,Any
]],None
)]) – The LR scheduler to use during training.learning_rate¶ (
Optional
[float
]) – Learning rate to use for training, defaults to1e-3
.
- classmethod available_finetuning_strategies(cls)¶
Returns a list containing the keys of the available Finetuning Strategies.
- classmethod available_lr_schedulers(cls)¶
Returns a list containing the keys of the available LR schedulers.