likyoo / Siam-NestedUNet

The pytorch implementation for "SNUNet-CD: A Densely Connected Siamese Network for Change Detection of VHR Images"
MIT License
252 stars 60 forks source link

indices should be either on cpu or on the same device as the indexed tensor (cpu) #40

Open jungwonguk-up opened 1 year ago

jungwonguk-up commented 1 year ago

INFO:root:GPU AVAILABLE? True INFO:root:STARTING Dataset Creation INFO:root:STARTING Dataloading
INFO:root:LOADING Model INFO:root:STARTING training INFO:root:SET model mode to train! epoch 0 info 0 - 16: 0%| | 0/625 [00:00<?, ?it/s]C:\Dacon\Siam-NestedUNet-master\utils\metrics.py:33: UserWarning: Implicit dimension choice for log_softmax has been deprecated. Change the call to include dim=X as an argument. logpt = F.log_softmax(input) epoch 0 info 0 - 16: 0%| | 0/625 [00:02<?, ?it/s] Traceback (most recent call last):
File "train.py", line 94, in cd_loss = criterion(cd_preds, labels) File "C:\Dacon\Siam-NestedUNet-master\utils\losses.py", line 17, in hybrid_loss dice = dice_loss(prediction, target) File "C:\Dacon\Siam-NestedUNet-master\utils\metrics.py", line 75, in dice_loss true_1_hot = torch.eye(num_classes)[true.squeeze(1)] RuntimeError: indices should be either on cpu or on the same device as the indexed tensor (cpu)

i dont know what to do plz help me

bolin-sys commented 1 year ago

I meet this question too and I pass it by using the environment of Python 3.6, Pytorch 1.4 and torchvision 0.5.0