kuangliu / torchcv

TorchCV: a PyTorch vision library mimics ChainerCV
MIT License
394 stars 70 forks source link

device-side assert triggered #25

Closed AminAbd closed 6 years ago

AminAbd commented 6 years ago

I am facing this error, everytime I try to run the train.py

File "train.py", line 193, in train(epoch) File "train.py", line 152, in train loss = criterion(loc_preds, loc_targets, cls_preds, cls_targets) File "/home/ameen/anaconda3/envs/PythonEnv/lib/python3.5/site-packages/torch/nn/modules/module.py", line 491, in call result = self.forward(*input, **kwargs) File "/home/ameen/SSD9/SSD1/ssd_loss.py", line 77, in forward cls_loss[cls_targets<0] = 0 # set ignored loss to 0

Can Anyone help me with this

kelly08385 commented 6 years ago

I have the same error, have you solved this problem?

AminAbd commented 6 years ago

No. I didnt solve it. Does anyone know the reason for this error? Btw, I am using my own dataset with 2 classes. it was working with the previous version of SSD provided by kuangliu. However, after updating pytorch to 0.4 and trying this new code, it stopped working.

cls_loss type is: torch.cuda.FloatTensor cls_loss size is: torch.Size([ 32, 24564])

cls_targets<0 type is: torch.cuda.ByteTensor cls_targets<0 size is: torch.Size([ 32, 24564])

AminAbd commented 6 years ago

Hey @kelly08385, I read in your other post that you managed to train your model. how did you solve this problem? Thanks in advance

kelly08385 commented 6 years ago

@AminAbd I ran fpnssd/train.py on voc data, after I replaced FPNSSD512(num_classes=9).to(device) to FPNSSD512(num_classes=21).to(device), it can start training.

AmeenElsiddig commented 6 years ago

Thanks @kelly08385 , I tried the same SSD code with the VOC dataset and it worked. I need to review the code again to see why it didnt work with my dataset of 2 classes. Thanks again

AminAbd commented 6 years ago

I solved the problem. It was a mistake in my annotation file.