Last active
June 29, 2021 10:44
-
-
Save Ed-Optalysys/50fe517b8a6a38880974ec820c0dfb1b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def normalised_squared_euclidean_distance(m_1, m_2): | |
return torch.mean(torch.square(m_1 - m_2)) | |
def vgg_feature_loss(prediction, target, loss_model): | |
p_features = loss_model.forward_features(prediction).relu2_2 | |
t_features = loss_model.forward_features(target).relu2_2 | |
return normalised_squared_euclidean_distance(p_features, t_features) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment