MCPcopy Create free account
hub / github.com/VCIP-RGBD/DFormer / init_weights

Method init_weights

models/builder.py:200–223  ·  view source on GitHub ↗
(self, cfg, pretrained=None)

Source from the content-addressed store, hash-verified

198 self.init_weights(cfg, pretrained=cfg.pretrained_model)
199
200 def init_weights(self, cfg, pretrained=None):
201 if pretrained:
202 logger.info("Loading pretrained model: {}".format(pretrained))
203 self.backbone.init_weights(pretrained=pretrained)
204 logger.info("Initing weights ...")
205 init_weight(
206 self.decode_head,
207 nn.init.kaiming_normal_,
208 self.norm_layer,
209 cfg.bn_eps,
210 cfg.bn_momentum,
211 mode="fan_in",
212 nonlinearity="relu",
213 )
214 if self.aux_head:
215 init_weight(
216 self.aux_head,
217 nn.init.kaiming_normal_,
218 self.norm_layer,
219 cfg.bn_eps,
220 cfg.bn_momentum,
221 mode="fan_in",
222 nonlinearity="relu",
223 )
224
225 def encode_decode(self, rgb, modal_x):
226 """Encode images with backbone and decode into a semantic segmentation

Callers 1

__init__Method · 0.95

Calls 2

init_weightFunction · 0.90
formatMethod · 0.45

Tested by

no test coverage detected