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

Training issue #88

Open
leonardoaraujosantos opened this issue May 9, 2018 · 3 comments
Open

Training issue #88

leonardoaraujosantos opened this issue May 9, 2018 · 3 comments

Comments

@leonardoaraujosantos
Copy link

Hi, I've cloned the code today and try the training and got the following error

python3 train.py
/home/leoara01/work/yolo2-pytorch/darknet.py:214: UserWarning: Implicit dimension choice for softmax has been deprecated. Change the call to include dim=X as an argument.
  prob_pred = F.softmax(score_pred.view(-1, score_pred.size()[-1])).view_as(score_pred)  # noqa
Traceback (most recent call last):
  File "train.py", line 78, in <module>
    bbox_loss += net.bbox_loss.data.cpu().numpy()[0]
IndexError: too many indices for array

I'm using pytorch 0.4

@longcw
Copy link
Owner

longcw commented May 10, 2018

#59

@leonardoaraujosantos
Copy link
Author

Thanks, I will check that now

@leonardoaraujosantos
Copy link
Author

Hi @longcw now it works, here are the changes

leoara01@linuxdev:~/work/yolo2-pytorch$ git diff train.py
diff --git a/train.py b/train.py
index 8c33cb4..51ba809 100644
--- a/train.py
+++ b/train.py
@@ -75,10 +75,10 @@ for step in range(start_epoch * imdb.batch_per_epoch,
 
     # backward
     loss = net.loss
-    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]
+    bbox_loss += net.bbox_loss.data.cpu().item()
+    iou_loss += net.iou_loss.data.cpu().item()
+    cls_loss += net.cls_loss.data.cpu().item()
+    train_loss += loss.data.cpu().item()
     optimizer.zero_grad()
     loss.backward()
     optimizer.step()

Would you like that I create a Pull request for the issue?

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