MCPcopy Create free account
hub / github.com/OpenDriveLab/ReSim / __init__

Method __init__

sat/sgm/modules/autoencoding/lpips/loss/lpips.py:14–26  ·  view source on GitHub ↗
(self, use_dropout=True)

Source from the content-addressed store, hash-verified

12class LPIPS(nn.Module):
13 # Learned perceptual metric
14 def __init__(self, use_dropout=True):
15 super().__init__()
16 self.scaling_layer = ScalingLayer()
17 self.chns = [64, 128, 256, 512, 512] # vg16 features
18 self.net = vgg16(pretrained=True, requires_grad=False)
19 self.lin0 = NetLinLayer(self.chns[0], use_dropout=use_dropout)
20 self.lin1 = NetLinLayer(self.chns[1], use_dropout=use_dropout)
21 self.lin2 = NetLinLayer(self.chns[2], use_dropout=use_dropout)
22 self.lin3 = NetLinLayer(self.chns[3], use_dropout=use_dropout)
23 self.lin4 = NetLinLayer(self.chns[4], use_dropout=use_dropout)
24 self.load_from_pretrained()
25 for param in self.parameters():
26 param.requires_grad = False
27
28 def load_from_pretrained(self, name="vgg_lpips"):
29 ckpt = get_ckpt_path(name, "sgm/modules/autoencoding/lpips/loss")

Callers 3

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls 5

load_from_pretrainedMethod · 0.95
ScalingLayerClass · 0.85
vgg16Class · 0.85
NetLinLayerClass · 0.85
parametersMethod · 0.80

Tested by

no test coverage detected