MCPcopy Create free account
hub / github.com/MiniMax-AI/VTP / __init__

Method __init__

vtp/utils/lpips.py:64–76  ·  view source on GitHub ↗
(self, use_dropout=True)

Source from the content-addressed store, hash-verified

62 """Learned perceptual metric."""
63
64 def __init__(self, use_dropout=True):
65 super().__init__()
66 self.scaling_layer = ScalingLayer()
67 self.chns = [64, 128, 256, 512, 512] # vgg16 features
68 self.net = vgg16(pretrained=True, requires_grad=False)
69 self.lin0 = NetLinLayer(self.chns[0], use_dropout=use_dropout)
70 self.lin1 = NetLinLayer(self.chns[1], use_dropout=use_dropout)
71 self.lin2 = NetLinLayer(self.chns[2], use_dropout=use_dropout)
72 self.lin3 = NetLinLayer(self.chns[3], use_dropout=use_dropout)
73 self.lin4 = NetLinLayer(self.chns[4], use_dropout=use_dropout)
74 self.load_from_pretrained()
75 for param in self.parameters():
76 param.requires_grad = False
77
78 def load_from_pretrained(self, name="vgg_lpips"):
79 ckpt = get_ckpt_path(name)

Callers 3

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls 4

load_from_pretrainedMethod · 0.95
ScalingLayerClass · 0.85
vgg16Class · 0.85
NetLinLayerClass · 0.85

Tested by

no test coverage detected