XuJiacong / PIDNet

This is the official repository for our recent work: PIDNet
MIT License
596 stars 109 forks source link

请问以下问题改怎么解决? #83

Open DaWenxi777 opened 8 months ago

DaWenxi777 commented 8 months ago

Traceback (most recent call last): File "/home/hipeson/ljh/A-pidnet-main/tools/train.py", line 218, in main() File "/home/hipeson/ljh/A-pidnet-main/tools/train.py", line 180, in main train(config, epoch, config.TRAIN.ENDEPOCH, File "/home/hipeson/ljh/A-pidnet-main/tools/../utils/function.py", line 43, in train losses, , acc, loss_list = model(images, labels, bd_gts) File "/home/hipeson/anaconda3/envs/myopenmmlab/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, kwargs) File "/home/hipeson/anaconda3/envs/myopenmmlab/lib/python3.8/site-packages/torch/nn/parallel/data_parallel.py", line 165, in forward return self.module(*inputs[0], *kwargs[0]) File "/home/hipeson/anaconda3/envs/myopenmmlab/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(input, kwargs) File "/home/hipeson/ljh/A-pidnet-main/tools/../utils/utils.py", line 50, in forward loss_b = self.bd_loss(outputs[-1], bd_gt) File "/home/hipeson/anaconda3/envs/myopenmmlab/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl result = self.forward(*input, *kwargs) File "/home/hipeson/ljh/A-pidnet-main/tools/../utils/criterion.py", line 129, in forward bce_loss = self.coeff_bce weighted_bce(bd_pre, bd_gt) File "/home/hipeson/ljh/A-pidnet-main/tools/../utils/criterion.py", line 114, in weighted_bce weight[pos_index] = neg_num * 1.0 / sum_num IndexError: The shape of the mask [1, 6] at index 1 does not match the shape of the indexed tensor [1, 524288] at index 1