sup3r.utilities.loss_metrics.PerceptualLoss#
- class PerceptualLoss(layer_names=None)[source]#
Bases:
Sup3rLossPerceptual loss that is calculated as MSE between feature maps of ground truth and synthetic data
- Parameters:
layer_names (list | None) – List of layer names in VGG16 to use to extract feature maps from ground truth and synthetic data. Defaults to [‘block1_conv2’, ‘block2_conv2’]
Methods
call(x_true, x_gen)Perceptual loss calculated on true and synthetic feature maps
from_config(config)get_config()Attributes
dtype- call(x_true, x_gen)[source]#
Perceptual loss calculated on true and synthetic feature maps
- Parameters:
x_true (tf.tensor) – True high resolution data, shape is either of these: (n_obs, spatial_1, spatial_2, features) (n_obs, spatial_1, spatial_2, temporal, features)
x_gen (tf.tensor) – Synthetic high-res generator output, shape is either of these: (n_obs, spatial_1, spatial_2, features) (n_obs, spatial_1, spatial_2, temporal, features)
- Returns:
tf.tensor – 0D tensor loss value
- __call__(y_true, y_pred, sample_weight=None)#
Call self as a function.