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

Method __init__

src/encoding/networks.py:228–255  ·  view source on GitHub ↗
(self, geo_feat_channels, tex_feat_channels, feat_channel_up, mlp_hidden_channels, mlp_hidden_layers, use_tex=True, tex_channels=3, posenc=0)

Source from the content-addressed store, hash-verified

226
227class AutoEncoderGroupPBR(nn.Module):
228 def __init__(self, geo_feat_channels, tex_feat_channels, feat_channel_up, mlp_hidden_channels, mlp_hidden_layers, use_tex=True, tex_channels=3, posenc=0) -> None:
229 super().__init__()
230 self.use_tex = use_tex
231
232 self.geo_encoder = nn.Conv3d(1, geo_feat_channels, kernel_size=4, stride=2, padding=1, bias=True)
233 if use_tex:
234 self.tex_encoder = nn.Conv3d(tex_channels + 1, tex_feat_channels, kernel_size=4, stride=2, padding=1, bias=True)
235 out_channels = geo_feat_channels + tex_feat_channels if use_tex else geo_feat_channels
236 self.norm = nn.InstanceNorm2d(out_channels)
237
238 self.geo_feat_dim = geo_feat_channels
239 self.tex_feat_dim = tex_feat_channels
240
241 self.geo_convs = TriplaneGroupResnetBlock(
242 geo_feat_channels, feat_channel_up, ks=5, input_norm=False, input_act=False
243 )
244 self.geo_decoder = DecoderMLPSkipConcat(feat_channel_up, 1, mlp_hidden_channels, mlp_hidden_layers)
245
246 if use_tex:
247 self.tex_convs = nn.Sequential(
248 TriplaneGroupResnetBlock(tex_feat_channels, feat_channel_up, ks=3, input_norm=False, input_act=False),
249 TriplaneGroupResnetBlock(feat_channel_up, feat_channel_up, ks=3, input_norm=True, input_act=True),
250 )
251 self.rgb_decoder = DecoderMLPSkipConcat(feat_channel_up, 3, mlp_hidden_channels, mlp_hidden_layers, posenc=posenc)
252 self.mr_decoder = DecoderMLPSkipConcat(feat_channel_up, 2, mlp_hidden_channels, mlp_hidden_layers, posenc=posenc)
253 self.normal_decoder = DecoderMLPSkipConcat(feat_channel_up, 3, mlp_hidden_channels, mlp_hidden_layers, posenc=posenc)
254
255 self.register_buffer("aabb", torch.tensor([-1, -1, -1, 1, 1, 1], dtype=torch.float32))
256
257 def geo_parameters(self):
258 return list(self.geo_encoder.parameters()) + list(self.geo_convs.parameters()) + list(self.geo_decoder.parameters())

Callers

nothing calls this directly

Calls 3

__init__Method · 0.45

Tested by

no test coverage detected