Skip to content
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

Upgrade train.py to pytorch 0.4.0 #59

Open
Erotemic opened this issue Mar 16, 2018 · 1 comment
Open

Upgrade train.py to pytorch 0.4.0 #59

Erotemic opened this issue Mar 16, 2018 · 1 comment

Comments

@Erotemic
Copy link

The current training script breaks with the new version of pytorch. The fix is to replace lines 88-92 of train.py with:

    if torch.__version__.startswith('0.3'):
        bbox_loss += net.bbox_loss.data.cpu().numpy()[0]
        iou_loss += net.iou_loss.data.cpu().numpy()[0]
        cls_loss += net.cls_loss.data.cpu().numpy()[0]
        train_loss += loss.data.cpu().numpy()[0]
    else:
        bbox_loss += float(net.bbox_loss.data.cpu().numpy())
        iou_loss += float(net.iou_loss.data.cpu().numpy())
        cls_loss += float(net.cls_loss.data.cpu().numpy())
        train_loss += float(loss.data.cpu().numpy())
@longcw
Copy link
Owner

longcw commented May 6, 2018

Or you can get the scalar using net.bbox_loss.item() in pytorch0.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants