Initialize the weights in backbone and heads. Args: pretrained (str, optional): Path to pre-trained weights. Defaults to None.
(self, pretrained=None)
| 57 | self.auxiliary_head = builder.build_head(auxiliary_head) |
| 58 | |
| 59 | def init_weights(self, pretrained=None): |
| 60 | """Initialize the weights in backbone and heads. |
| 61 | |
| 62 | Args: |
| 63 | pretrained (str, optional): Path to pre-trained weights. |
| 64 | Defaults to None. |
| 65 | """ |
| 66 | |
| 67 | super(EncoderDecoder, self).init_weights(pretrained) |
| 68 | self.backbone.init_weights(pretrained=pretrained) |
| 69 | self.decode_head.init_weights() |
| 70 | if self.with_auxiliary_head: |
| 71 | if isinstance(self.auxiliary_head, nn.ModuleList): |
| 72 | for aux_head in self.auxiliary_head: |
| 73 | aux_head.init_weights() |
| 74 | else: |
| 75 | self.auxiliary_head.init_weights() |
| 76 | |
| 77 | def extract_feat(self, img): |
| 78 | """Extract features from images.""" |