From e6f68df8f372cd923bc43279ec1cc2104247f179 Mon Sep 17 00:00:00 2001 From: Selig209 Date: Sat, 25 Apr 2026 23:51:36 +0000 Subject: [PATCH] [Fix] DDRNet: use actual spatial dims after stem to fix resize mismatch --- mmseg/models/backbones/ddrnet.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mmseg/models/backbones/ddrnet.py b/mmseg/models/backbones/ddrnet.py index 4508aade82..4b7a3d13fc 100644 --- a/mmseg/models/backbones/ddrnet.py +++ b/mmseg/models/backbones/ddrnet.py @@ -180,11 +180,14 @@ def _make_layer(self, block, inplanes, planes, num_blocks, stride=1): def forward(self, x): """Forward function.""" - out_size = (x.shape[-2] // 8, x.shape[-1] // 8) # stage 0-2 x = self.stem(x) + # Use actual spatial dims after stem to avoid off-by-one errors + # when input resolution is not perfectly divisible by 8. + out_size = x.shape[-2:] + # stage3 x_c = self.context_branch_layers[0](x) x_s = self.spatial_branch_layers[0](x)