MCPcopy Create free account
hub / github.com/IceClear/StableSR / __init__

Method __init__

ldm/modules/spade.py:69–88  ·  view source on GitHub ↗
(self, norm_nc, label_nc, config_text='spadeinstance3x3')

Source from the content-addressed store, hash-verified

67# |label_nc|: the #channels of the input semantic map, hence the input dim of SPADE
68class SPADE(nn.Module):
69 def __init__(self, norm_nc, label_nc, config_text='spadeinstance3x3'):
70 super().__init__()
71
72 assert config_text.startswith('spade')
73 parsed = re.search('spade(\D+)(\d)x\d', config_text)
74 param_free_norm_type = str(parsed.group(1))
75 ks = int(parsed.group(2))
76
77 self.param_free_norm = normalization(norm_nc)
78
79 # The dimension of the intermediate embedding space. Yes, hardcoded.
80 nhidden = 128
81
82 pw = ks // 2
83 self.mlp_shared = nn.Sequential(
84 nn.Conv2d(label_nc, nhidden, kernel_size=ks, padding=pw),
85 nn.ReLU()
86 )
87 self.mlp_gamma = nn.Conv2d(nhidden, norm_nc, kernel_size=ks, padding=pw)
88 self.mlp_beta = nn.Conv2d(nhidden, norm_nc, kernel_size=ks, padding=pw)
89
90 def forward(self, x_dic, segmap_dic, size=None):
91

Callers

nothing calls this directly

Calls 1

normalizationFunction · 0.90

Tested by

no test coverage detected