MCPcopy Create free account
hub / github.com/NVlabs/SegFormer / encode_decode

Method encode_decode

mmseg/models/segmentors/encoder_decoder.py:84–94  ·  view source on GitHub ↗

Encode images with backbone and decode into a semantic segmentation map of the same size as input.

(self, img, img_metas)

Source from the content-addressed store, hash-verified

82 return x
83
84 def encode_decode(self, img, img_metas):
85 """Encode images with backbone and decode into a semantic segmentation
86 map of the same size as input."""
87 x = self.extract_feat(img)
88 out = self._decode_head_forward_test(x, img_metas)
89 out = resize(
90 input=out,
91 size=img.shape[2:],
92 mode='bilinear',
93 align_corners=self.align_corners)
94 return out
95
96 def _decode_head_forward_train(self, x, img_metas, gt_semantic_seg):
97 """Run forward function and calculate loss for decode head in

Callers 3

forward_dummyMethod · 0.95
slide_inferenceMethod · 0.95
whole_inferenceMethod · 0.95

Calls 3

extract_featMethod · 0.95
resizeFunction · 0.90

Tested by

no test coverage detected