charlesCXK / TorchSemiSeg

[CVPR 2021] CPS: Semi-Supervised Semantic Segmentation with Cross Pseudo Supervision
MIT License
504 stars 74 forks source link

when I run script.sh of city8.res50v3+.CPS+CutMix,it happens some wrong.It seems unsup_imgs's data are all zeros.Could I know how to solve it? #58

Closed Joe-Tony-Joe closed 2 years ago

Joe-Tony-Joe commented 2 years ago

Traceback (most recent call last): File "train.py", line 229, in _, logits_u0_tea_1 = model(unsup_imgs_0, step=1) File "/root/miniconda3/envs/semiseg/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in call result = self.forward(*input, kwargs) File "/root/miniconda3/envs/semiseg/lib/python3.6/site-packages/apex-0.1-py3.6-linux-x86_64.egg/apex/parallel/distributed.py", line 459, in forward result = self.module(*inputs, *kwargs) File "/root/miniconda3/envs/semiseg/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in call result = self.forward(input, kwargs) File "/root/autodl-tmp/TorchSemiSeg-main/exp.city/city8.res50v3+.CPS+CutMix/network.py", line 28, in forward return self.branch1(data) File "/root/miniconda3/envs/semiseg/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in call result = self.forward(*input, kwargs) File "/root/autodl-tmp/TorchSemiSeg-main/exp.city/city8.res50v3+.CPS+CutMix/network.py", line 54, in forward v3plus_feature = self.head(blocks) # (b, c, h, w) File "/root/miniconda3/envs/semiseg/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in call result = self.forward(*input, *kwargs) File "/root/autodl-tmp/TorchSemiSeg-main/exp.city/city8.res50v3+.CPS+CutMix/network.py", line 175, in forward f = self.aspp(f) File "/root/miniconda3/envs/semiseg/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in call result = self.forward(input, kwargs) File "/root/autodl-tmp/TorchSemiSeg-main/exp.city/city8.res50v3+.CPS+CutMix/network.py", line 122, in forward pool = self.global_pooling_bn(pool) File "/root/miniconda3/envs/semiseg/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in call result = self.forward(*input, *kwargs) File "/root/miniconda3/envs/semiseg/lib/python3.6/site-packages/apex-0.1-py3.6-linux-x86_64.egg/apex/parallel/sync_batchnorm.py", line 114, in forward (m-1) self.momentum * var + \ ZeroDivisionError: float division by zero

charlesCXK commented 2 years ago

Hi, this is caused by batch size=1. Something is wrong with SyncBN in such as case.

Joe-Tony-Joe commented 2 years ago

Oh, thank you! I have run it successfully!

yjq767579182 commented 1 year ago

@Joe-Tony-Joe hello I would like to ask how to run city8.res50v3+.CPS + CutMix and what commands are needed? Do you use one GPU for training?