justchenhao / STANet

official implementation of the spatial-temporal attention neural network (STANet) for remote sensing image change detection
BSD 2-Clause "Simplified" License
405 stars 110 forks source link

IndexError: boolean index did not match indexed array along dimension 0; dimension is 67108864 #87

Open weizhiliang0520 opened 2 years ago

weizhiliang0520 commented 2 years ago

tcmalloc: large alloc 2147483648 bytes == 0x55577043e000 @ 0x7ff56448eb6b 0x7ff5644ae379 0x7ff463c93cde 0x7ff463c95452 0x7ff4b5cbccf3 0x7ff4b5d44158 0x7ff4b641b49f 0x7ff4b63fb870 0x7ff4b61e648a 0x7ff4b5d3529d 0x7ff4b6514aca 0x7ff4b63f770e 0x7ff4b5fbcd17 0x7ff4b791f7c4 0x7ff4b791fc8d 0x7ff4b60326e8 0x7ff4b5d333d5 0x7ff4b659b970 0x7ff4b62e8069 0x7ff55f0f42c3 0x7ff55f24e04e 0x5557057cf4b0 0x5557058c0e1d 0x555705842e99 0x55570583d9ee 0x5557057d0bda 0x55570583f737 0x5557057d0afa 0x55570583e915 0x55570583d9ee 0x55570583d6f3 Traceback (most recent call last): File "train.py", line 169, in miou_current = val(opt, model) File "train.py", line 86, in val score = model.test(val=True) # run inference File "/content/drive/MyDrive/Experiment/codes/33_STANet/STANet/models/CDF0_model.py", line 77, in test metrics.update(self.L.detach().cpu().numpy(), pred.detach().cpu().numpy()) File "/content/drive/MyDrive/Experiment/codes/33_STANet/STANet/util/metrics.py", line 121, in update self.confusion_matrix += self.fast_hist(lt.flatten(), lp.flatten()) File "/content/drive/MyDrive/Experiment/codes/33_STANet/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 67108864 but corresponding boolean dimension is 1048576

yilye commented 2 years ago

CDFA_model.py insert 93 line: self.dist = torch.transpose(self.dist, 1, 3) ... self.dist = F.pairwise_distance(self.feat_A, self.feat_B, keepdim=True) # 特征距离 self.dist = torch.transpose(self.dist, 1, 3) self.dist = F.interpolate(self.dist, size=self.A.shape[2:], mode='bilinear',align_corners=True) ...

wang673523745 commented 2 years ago

降低numpy的版本即可