milesial / Pytorch-UNet

PyTorch implementation of the U-Net for image semantic segmentation with high quality images
GNU General Public License v3.0
9.3k stars 2.51k forks source link

RuntimeError: number of dims don't match in permute #366

Open 40618233 opened 2 years ago

40618233 commented 2 years ago

Hi,I have this problem, can you help me?

Traceback (most recent call last): File "c:/Users/Hong/PycharmProjects/Pytorch-UNet-master/train.py", line 207, in train_net(net=net, File "c:/Users/Hong/PycharmProjects/Pytorch-UNet-master/train.py", line 132, in train_net val_score = evaluate(net, val_loader, device) File "c:\Users\Hong\PycharmProjects\Pytorch-UNet-master\evaluate.py", line 19, in evaluate mask_true = F.one_hot(mask_true, net.n_classes).permute(256,256,256,256).float() RuntimeError: number of dims don't match in permute

Mountainsmaydepart commented 2 years ago

i think permute(256,256,256,256) is wrong you can try to understand how permute is used