CSAILVision / semantic-segmentation-pytorch

Pytorch implementation for Semantic Segmentation/Scene Parsing on MIT ADE20K dataset
http://sceneparsing.csail.mit.edu/
BSD 3-Clause "New" or "Revised" License
4.96k stars 1.1k forks source link

Issue with PPM Decoder Code: BN Layer in the code doesn't work with 1x1 resolution input. #221

Closed rishab-sharma closed 4 years ago

rishab-sharma commented 4 years ago

ValueError: Expected more than 1 value per channel when training, got input size torch.Size([1, 512, 1, 1])

I tried to use the code of your PPM Decoder without DeepSup with a Resnet50 encoder...It breaks at pool_scale(conv5)

Where one of the scales leads to 1x1 map, followed by a BN.

This is resolved by making the net.eval() call, but what to do during training?

daveboat commented 4 years ago

I have this problem as well. Did you manage to resolve it?

Edit: Never mind, I forgot BN doesn't make sense if the batch size is 1 during training.