MCPcopy Create free account
hub / github.com/Sin3DM/Sin3DM / __init__

Method __init__

evaluation/lpips.py:53–62  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

51
52class LPIPS(nn.Module):
53 def __init__(self):
54 super().__init__()
55 self.alexnet = AlexNet()
56 self.lpips_weights = nn.ModuleList()
57 for channels in self.alexnet.channels:
58 self.lpips_weights.append(Conv1x1(channels, 1))
59 self._load_lpips_weights()
60 # imagenet normalization for range [-1, 1]
61 self.mu = torch.tensor([-0.03, -0.088, -0.188]).view(1, 3, 1, 1) # .cuda()
62 self.sigma = torch.tensor([0.458, 0.448, 0.450]).view(1, 3, 1, 1) # .cuda()
63
64 def _load_lpips_weights(self):
65 own_state_dict = self.state_dict()

Callers 2

__init__Method · 0.45
__init__Method · 0.45

Calls 3

_load_lpips_weightsMethod · 0.95
AlexNetClass · 0.85
Conv1x1Class · 0.85

Tested by

no test coverage detected