-
Notifications
You must be signed in to change notification settings - Fork 249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RuntimeError: Expected object of type torch.cuda.FloatTensor but found type torch.cuda.LongTensor for argument #2 'other' #62
Comments
In utils.py you need to change the following by
Also you probably need to change every call like .data[0] by .item() |
I modify it as you suggest, but the following errors have occurred: what's problem? Can you help me,Thank you very much! |
You did But it should be Check other references like this and change them all |
Thank you very much! I run the train.py successfully ! |
Sorry, disturb you. I was wondering if loss is this kind of situation is correct, when it is starting training! loc_loss: 0.085 | cls_loss: 0.001 | train_loss: 0.087 | avg_loss: 0.088 |
Difficult to say without knowing what you want to train. |
I am training on VOC2012 dataset that match the file ./data/voc12_train.txt and voc12_val.txt in this repo. Then i modify the loss.py follow you #56 , the problem got a little better, but it didn't make much difference |
Have you used the script get_state_dict.py ? |
yes, i used the script get_state_dict.py and generated the net.pth.Do you train on the voc ? How do i know that the train is right. |
I started training on Pascal VOC set, loss starts at 1.4 |
I took the loss implementation from Issue #52 and started training on VOC |
I downloaded the images from VOC2007test, but I runed the test.py , there are many boxes on the detected image, I think there's a problem with that code. And you? |
I trained on the VOC dataset and saw that with the loss of #52 it trained, but the results were NOK. (hundreds of boxes detected)
|
|
Why is it modified like this? I don't quite understand xt. I used the author another repo that is torchcv.but I get 20.3map in 2007testvoc. can i see you code modified? |
when i run the train.py, there is a problem as fellow:
/home/sunshine_zkf/RetinaNet/pytorch-retinanet-master/loss.py:95: UserWarning: invalid index of a 0-dim tensor. This will be an error in PyTorch 0.5. Use tensor.item() to convert a 0-dim tensor to a Python number
print('loc_loss: %.3f | cls_loss: %.3f' % (loc_loss.data[0]/num_pos, cls_loss.data[0]/num_peg), end=' | ')
Traceback (most recent call last):
File "/home/sunshine_zkf/RetinaNet/pytorch-retinanet-master/train.py", line 116, in
train(epoch)
File "/home/sunshine_zkf/RetinaNet/pytorch-retinanet-master/train.py", line 77, in train
loss = criterion(loc_preds, loc_targets, cls_preds, cls_targets)
File "/home/sunshine_zkf/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 491, in call
result = self.forward(*input, **kwargs)
File "/home/sunshine_zkf/RetinaNet/pytorch-retinanet-master/loss.py", line 95, in forward
print('loc_loss: %.3f | cls_loss: %.3f' % (loc_loss.data[0]/num_pos, cls_loss.data[0]/num_peg), end=' | ')
RuntimeError: Expected object of type torch.cuda.FloatTensor but found type torch.cuda.LongTensor for argument #2 'other'
why? Can you help me? Thank you very much!
The text was updated successfully, but these errors were encountered: