Closed sddnuaa closed 1 year ago
@sddnuaa 从报错日志来看,应该是UNet3P只有一个输出,但是你的配置文件里面配置了5个Loss
谢谢,已解决
谢谢,已解决
您好,我也碰到同样的问题了,想请问下是怎么解决的?
打开deepsup和CSM后,需要根据输入情况配置loss个数 @conlaysmile
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.
from paddleseg.models import UNet3Plus,在定义model = UNet3Plus(in_channels=3, num_classes=2)能正常训练,打开deepsup和CSM,model = UNet3Plus(in_channels=3, num_classes=2, is_deepsup=True, is_CGM=True),训练报错。
报错代码如下: /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dataloader/dataloaderiter.py:89: DeprecationWarning: in
17 num_workers=0,
18 losses=losses,
---> 19 use_vdl=True)
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddleseg/core/train.py in train(model, train_dataset, val_dataset, optimizer, save_dir, iters, batch_size, resume_model, save_interval, log_iters, num_workers, use_vdl, losses, keep_checkpoint_max, test_config, fp16)
183 labels=labels,
184 losses=losses,
--> 185 edges=edges)
186 loss = sum(loss_list)
187 loss.backward()
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddleseg/core/train.py in loss_computation(logits_list, labels, losses, edges)
35
36 def loss_computation(logits_list, labels, losses, edges=None):
---> 37 check_logits_losses(logits_list, losses)
38 loss_list = []
39 for i in range(len(logits_list)):
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddleseg/core/train.py in check_logits_losses(logits_list, losses)
31 raise RuntimeError(
32 'The length of logits_list should equal to the types of loss config: {} != {}.'
---> 33 .format(len_logits, len_losses))
34
35
RuntimeError: The length of logits_list should equal to the types of loss config: 5 != 1.
np.bool
is a deprecated alias for the builtinbool
. To silence this warning, usebool
by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool` here. Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations if isinstance(slot[0], (np.ndarray, np.bool, numbers.Number)): /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/math_op_patch.py:238: UserWarning: The dtype of left and right variables are not the same, left dtype is VarType.FP64, but right dtype is VarType.FP32, the right dtype will convert to VarType.FP64 format(lhs_dtype, rhs_dtype, lhs_dtype)) /opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/paddle/fluid/dygraph/math_op_patch.py:238: UserWarning: The dtype of left and right variables are not the same, left dtype is VarType.FP32, but right dtype is VarType.FP64, the right dtype will convert to VarType.FP32 format(lhs_dtype, rhs_dtype, lhs_dtype)) ---------------------------------------------------------------------------RuntimeError Traceback (most recent call last)请哪位大神帮忙解决一下?