Skip to content

LPIPS Loss producing negative values #72

@GuillaumeRochette

Description

@GuillaumeRochette

Hi,

While running the LPIPS loss based on AlexNet, I obtained a negative value,

a = LPIPS(net="alex", verbose=False)
x = torch.rand(4, 3, 256, 256)
y = torch.rand(4, 3, 256, 256)
z = a(x, y, normalize=True)
print(z)

While looking at the values contained in res (defined in the forward()), I have noticed that the implementation does not match the Eq. 1 from the paper.

Here's Eq. 1:
image

While this is what is implemented,
image

The square operation ** 2 at line 94 should be removed and instead applied on the self.lins[kk].model(diffs[kk]) (at lines 98 and 100), and on diff[kk] (at lines 103 and 105).

Thanks in advance,

Guillaume

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions