You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug ContentLoss is a super class of multiple feature-based metrics including DISTS. However, there is a semantic discrepancy between these two for parameters such as weights and layers:
For ContentLoss: weights is a collection of scalars, which are used to scale feature outputs from layers;
For DISTS: weights is a collection of scalars, which are used to scale features that are computed in a sophisticated way, provided by the custom self.distance function, which produces two types of features (structure_distance and texture_distance), which also include the initial data tensor.
This misalignment leads to the following: in general case len(weights) == len(layers) because otherwise some weights or layers are ignores and not used during computation of the feature-based metric. However, neither assert nor warning can be used in the ContentLoss class because it will provide incorrect behaviour for DISTS.
To Reproduce
Steps to reproduce the behavior:
Put assert len(layers) == len(weights) in the initializer for the ContentLoss class;
Run tests or manually run code with feature-based metrics;
Observe that initialization of DISTS fails due to the added assert;
Observe error message, where len(layers) == 5 and len(weights) == 12.
Expected behavior
All feature-based metrics have the same semantic for passed parameters.
Additional context
The problem was revealed during work on #258
The text was updated successfully, but these errors were encountered:
Discussed during monthly meeting that we need to refactor code for perceptual metrics and split them to work individually without complicated inheritance.
Describe the bug
ContentLoss
is a super class of multiple feature-based metrics includingDISTS
. However, there is a semantic discrepancy between these two for parameters such asweights
andlayers
:ContentLoss
:weights
is a collection of scalars, which are used to scale feature outputs fromlayers
;DISTS
:weights
is a collection of scalars, which are used to scale features that are computed in a sophisticated way, provided by the customself.distance
function, which produces two types of features (structure_distance
andtexture_distance
), which also include the initial data tensor.This misalignment leads to the following: in general case
len(weights) == len(layers)
because otherwise some weights or layers are ignores and not used during computation of the feature-based metric. However, neither assert nor warning can be used in theContentLoss
class because it will provide incorrect behaviour forDISTS
.To Reproduce
Steps to reproduce the behavior:
assert len(layers) == len(weights)
in the initializer for theContentLoss
class;DISTS
fails due to the added assert;len(layers) == 5
andlen(weights) == 12
.Expected behavior
All feature-based metrics have the same semantic for passed parameters.
Additional context
The problem was revealed during work on #258
The text was updated successfully, but these errors were encountered: