chenjun2hao / DDRNet.pytorch

This is the unofficial code of Deep Dual-resolution Networks for Real-time and Accurate Semantic Segmentation of Road Scenes. which achieve state-of-the-art trade-off between accuracy and speed on cityscapes and camvid, without using inference acceleration and extra data
Other
157 stars 42 forks source link

BatchNorm2d after AdaptiveAvgPool2d #29

Closed felixcrazzolara closed 11 months ago

felixcrazzolara commented 11 months ago

In the DAPPM module there is the following code for self.scale4:

nn.AdaptiveAvgPool2d((1, 1)),
nn.BatchNorm2d(inplanes, momentum=bn_mom),

I get an error saying Expected more than 1 value per channel when training, got input size torch.Size([1, 512, 1, 1]). I am not surprised since the AdaptiveAvgPool2d block reduces height and width of the layers to just 1 as can be seen in the error message as well. There is no way that the BatchNorm2d layer can then compute the standard deviation. How is this supposed to work?

felixcrazzolara commented 11 months ago

I had to do model.eval(), which makes sense.

Daniu-jiao commented 2 months ago

I had to do model.eval(), which makes sense.

Because the batch size you entered is 1