You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to train with default parameters and sunrgbd dataset with batch_size set to 1. The following error arises:
File "train.py", line 577, in <module>
train_main()
File "train.py", line 206, in train_main
label_downsampling_rates, args.epochs, args.results_dir, monitoring_images, debug_mode=args.debug)
File "train.py", line 310, in train_one_epoch
pred_scales = model(image, depth)
File "/home/matteo/anaconda3/envs/rgbd_segmentation/lib/python3.7/site-packages/torch/nn/modules/module.py", line 541, in __call__
result = self.forward(*input, **kwargs)
File "/home/matteo/Code/Semantic_Segmentation/ESANet/src/models/model.py", line 238, in forward
out = self.context_module(fuse)
File "/home/matteo/anaconda3/envs/rgbd_segmentation/lib/python3.7/site-packages/torch/nn/modules/module.py", line 541, in __call__
result = self.forward(*input, **kwargs)
File "/home/matteo/Code/Semantic_Segmentation/ESANet/src/models/context_modules.py", line 72, in forward
y = f(x)
File "/home/matteo/anaconda3/envs/rgbd_segmentation/lib/python3.7/site-packages/torch/nn/modules/module.py", line 541, in __call__
result = self.forward(*input, **kwargs)
File "/home/matteo/anaconda3/envs/rgbd_segmentation/lib/python3.7/site-packages/torch/nn/modules/container.py", line 92, in forward
input = module(input)
File "/home/matteo/anaconda3/envs/rgbd_segmentation/lib/python3.7/site-packages/torch/nn/modules/module.py", line 541, in __call__
result = self.forward(*input, **kwargs)
File "/home/matteo/anaconda3/envs/rgbd_segmentation/lib/python3.7/site-packages/torch/nn/modules/container.py", line 92, in forward
input = module(input)
File "/home/matteo/anaconda3/envs/rgbd_segmentation/lib/python3.7/site-packages/torch/nn/modules/module.py", line 541, in __call__
result = self.forward(*input, **kwargs)
File "/home/matteo/anaconda3/envs/rgbd_segmentation/lib/python3.7/site-packages/torch/nn/modules/batchnorm.py", line 81, in forward
exponential_average_factor, self.eps)
File "/home/matteo/anaconda3/envs/rgbd_segmentation/lib/python3.7/site-packages/torch/nn/functional.py", line 1666, in batch_norm
raise ValueError('Expected more than 1 value per channel when training, got input size {}'.format(size))
ValueError: Expected more than 1 value per channel when training, got input size torch.Size([1, 256, 1, 1])
Any hint on how to fix it?
The text was updated successfully, but these errors were encountered:
The error comes from the global average pooling in the context module. The output of the global branch has no spatial resolution any more (see your error). If you are using batchsize 1, there is only one element left for determining mean and std in the subsequent batch normalization, which is just not possible.
So you need a batchsize > 1 or you have to remove the global branch or the entire context module.
Note that this is requirement is only for training. Inference with batchsize 1 works well as the inference mode for batch normalization is different.
I tried to train with default parameters and sunrgbd dataset with batch_size set to 1. The following error arises:
Any hint on how to fix it?
The text was updated successfully, but these errors were encountered: