(
self,
backbone,
decode_head,
neck=None,
auxiliary_head=None,
train_cfg=None,
test_cfg=None,
pretrained=None,
init_cfg=None,
)
| 20 | """ |
| 21 | |
| 22 | def __init__( |
| 23 | self, |
| 24 | backbone, |
| 25 | decode_head, |
| 26 | neck=None, |
| 27 | auxiliary_head=None, |
| 28 | train_cfg=None, |
| 29 | test_cfg=None, |
| 30 | pretrained=None, |
| 31 | init_cfg=None, |
| 32 | ): |
| 33 | super(EncoderDecoder, self).__init__(init_cfg) |
| 34 | if pretrained is not None: |
| 35 | assert backbone.get("pretrained") is None, "both backbone and segmentor set pretrained weight" |
| 36 | backbone.pretrained = pretrained |
| 37 | self.backbone = builder.build_backbone(backbone) |
| 38 | if neck is not None: |
| 39 | self.neck = builder.build_neck(neck) |
| 40 | self._init_decode_head(decode_head) |
| 41 | self._init_auxiliary_head(auxiliary_head) |
| 42 | |
| 43 | self.train_cfg = train_cfg |
| 44 | self.test_cfg = test_cfg |
| 45 | |
| 46 | assert self.with_decode_head |
| 47 | |
| 48 | def _init_decode_head(self, decode_head): |
| 49 | """Initialize ``decode_head``""" |
nothing calls this directly
no test coverage detected