PaddleSeg icon indicating copy to clipboard operation
PaddleSeg copied to clipboard

MedicalSeg的问题

Open lusichao opened this issue 3 years ago • 3 comments
trafficstars

训练的时候出现错误: Traceback (most recent call last): File "train.py", line 194, in main(args) File "train.py", line 173, in main train( File "/root/PaddleSeg/contrib/MedicalSeg/medicalseg/core/train.py", line 132, in train logits_list = model(images) File "/root/anaconda3/lib/python3.8/site-packages/paddle/fluid/dygraph/layers.py", line 930, in call return self._dygraph_call_func(*inputs, **kwargs) File "/root/anaconda3/lib/python3.8/site-packages/paddle/fluid/dygraph/layers.py", line 915, in _dygraph_c outputs = self.forward(*inputs, **kwargs) File "/root/PaddleSeg/contrib/MedicalSeg/medicalseg/models/vnet.py", line 257, in forward out16 = self.in_tr(x) # dropout cause a lot align problem File "/root/anaconda3/lib/python3.8/site-packages/paddle/fluid/dygraph/layers.py", line 930, in call return self._dygraph_call_func(*inputs, **kwargs) File "/root/anaconda3/lib/python3.8/site-packages/paddle/fluid/dygraph/layers.py", line 915, in _dygraph_c outputs = self.forward(*inputs, **kwargs) File "/root/PaddleSeg/contrib/MedicalSeg/medicalseg/models/vnet.py", line 77, in forward out = self.bn1(out) File "/root/anaconda3/lib/python3.8/site-packages/paddle/fluid/dygraph/layers.py", line 930, in call return self._dygraph_call_func(*inputs, **kwargs) File "/root/anaconda3/lib/python3.8/site-packages/paddle/fluid/dygraph/layers.py", line 915, in _dygraph_c outputs = self.forward(*inputs, **kwargs) File "/root/anaconda3/lib/python3.8/site-packages/paddle/nn/layer/norm.py", line 1095, in forward sync_batch_norm_out, _, _, _, _, _ = _C_ops.sync_batch_norm( AttributeError: module 'paddle.fluid.core_avx.ops' has no attribute 'sync_batch_norm'

找了下_C_ops.py文件,没有sync_batch_norm的数据,

PaddlePaddle版本:(PaddlePaddle 2.3) 操作系统信息:(Ubuntu 18) Python版本号:(Python3.8) CUDA版本:( CUDA11.4)

lusichao avatar May 20 '22 12:05 lusichao

I think this is the problem with the paddle version, try switching to paddle==2.2. Btw, did you switch the bn1 from BatchNorm3D to SyncBatchNorm? The error is located within SyncBatchNorm.If you did, I think changing back to BatchNorm3D will help as well.

But it is a bit odd that I cannot reproduce your error with different paddle versions or different BN. Maybe you can put forward an issue to Paddle as well.

shiyutang avatar May 23 '22 03:05 shiyutang

解决了吗?我也报了同样的错误,怎么解决的

XuyangPan avatar Aug 25 '22 10:08 XuyangPan

解决了吗?我也报了同样的错误,怎么解决的

没解决,后来一直没再用。

lusichao avatar Aug 25 '22 14:08 lusichao

建议安装paddlepaddle2.4后重新尝试

shiyutang avatar Dec 02 '22 09:12 shiyutang

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jan 31 '23 17:01 github-actions[bot]

_C_ops为paddle内部库,在paddleseg中bn1也就是BatchNorm3D自动转为SyncBN,从而forward计算落入syncbn函数中,但此处的报错说明syncbn对应的_C_ops函数不存在,说明使用的paddle版本中没有SyncBN的定义,可以1. 取消转换syncbn,或者2. 切换有syncbn的paddle版本。

转换syncbn的代码位置: https://github.com/PaddlePaddle/PaddleSeg/blob/19351bab9a824a8f96e1c1b527ec2d7db21309c9/contrib/MedicalSeg/medicalseg/cvlibs/config.py#L322

shiyutang avatar Feb 08 '23 02:02 shiyutang