-
Notifications
You must be signed in to change notification settings - Fork 29
Description
报错信息如下:
Traceback (most recent call last):
File "/first_disk/hongzheng/CDLab-master/src/train.py", line 59, in main
trainer.run()
File "/first_disk/hongzheng/CDLab-master/src/core/trainer.py", line 75, in run
self.train()
File "/first_disk/hongzheng/CDLab-master/src/core/trainer.py", line 96, in train
acc = self.evaluate_epoch(epoch=epoch)
File "/first_disk/hongzheng/CDLab-master/src/impl/trainers/cd_trainer.py", line 185, in evaluate_epoch
loss = self.criterion(pred, tar)
File "/home/ly/miniconda3/envs/hz/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(args, **kwargs)
File "/home/ly/miniconda3/envs/hz/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(args, **kwargs)
File "/first_disk/hongzheng/CDLab-master/src/utils/losses.py", line 100, in forward
loss = 0.5torch.sum(utartorch.pow(pred, 2)) / n_u +
RuntimeError: The size of tensor a (4) must match the size of tensor b (64) at non-singleton dimension 1
或者
Traceback (most recent call last):
File "/first_disk/hongzheng/STANet/./train.py", line 169, in
miou_current = val(opt, model)
File "/first_disk/hongzheng/STANet/./train.py", line 86, in val
score = model.test(val=True) # run inference
File "/first_disk/hongzheng/STANet/models/CDFA_model.py", line 79, in test
metrics.update(self.L.detach().cpu().numpy(), pred.detach().cpu().numpy())
File "/first_disk/hongzheng/STANet/util/metrics.py", line 121, in update
self.confusion_matrix += self.__fast_hist(lt.flatten(), lp.flatten())
File "/first_disk/hongzheng/STANet/util/metrics.py", line 108, in __fast_hist
hist = np.bincount(self.num_classes * label_gt[mask].astype(int) + label_pred[mask],
IndexError: boolean index did not match indexed array along dimension 0; dimension is 4194304 but corresponding boolean dimension is 65536