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

loss nan #39

Closed
liyangliu opened this issue Jan 19, 2018 · 9 comments
Closed

loss nan #39

liyangliu opened this issue Jan 19, 2018 · 9 comments

Comments

@liyangliu
Copy link

Hello @jwyang, I downloaded your pytorch faster rcnn yesterday, only change the coco 2014 dataset path to my local one and trained exactly the same setting as you (large image scale, lr = 0.01, 2 images per gpu and 8 gpus, res101, using caffe pretrained models given by you) but got NAN loss after a few iteration. Have you come across this problem? The loss will not be NAN if I set class_agnostic=True. Can you please help me a little? Thanks.

@jwyang
Copy link
Owner

jwyang commented Jan 19, 2018

Hi, @liyangliu , could you share your training command and training log?

I did not encounter this problem.

@liyangliu
Copy link
Author

python trainval_net.py
--dataset coco
--net res101
--save_dir=exps/baseline/models
--cuda
--mGPUs
--bs 16
--nw 8
--epochs 10
--ls
--lr 0.01
--lr_decay_step 4
&> logs/baseline.log &

@yxgeee
Copy link

yxgeee commented Jan 19, 2018

Hi, I met this problem several times before. But it was solved when I run it again without any setting changes.

@jwyang
Copy link
Owner

jwyang commented Jan 19, 2018

@liyangliu I think we might have slightly different initializations. If you encounter this again, one way is to clamp the gradient for res101 as well by comment this line.

@gyxoned, have you successfully trained the model and get similar performance as reported in our tables?

@yxgeee
Copy link

yxgeee commented Jan 19, 2018

@jwyang Yes, I have trained resnet101 on coco successfully, and the performance is similar with reported.

@jwyang
Copy link
Owner

jwyang commented Jan 19, 2018

@gyxoned sounds great!

@jwyang jwyang closed this as completed Jan 19, 2018
@shenshanlaoma
Copy link

shenshanlaoma commented Jan 24, 2018

modify these 4 lines!delete “- 1”!
x1 = float(bbox.find('xmin').text) - 1
y1 = float(bbox.find('ymin').text) - 1
x2 = float(bbox.find('xmax').text) - 1
y2 = float(bbox.find('ymax').text) - 1

x1 = float(bbox.find('xmin').text) - 1

according to http://caffecn.cn/?/question/1055 https://stackoverflow.com/questions/38513739/warning-during-py-faster-rcnn-training-on-custom-datasets

@TomHeaven
Copy link

In my case, clamp the gradient for res101 is the correct solution of nan loss.

@liyangliu I think we might have slightly different initializations. If you encounter this again, one way is to clamp the gradient for res101 as well by comment this line.

@tangbohu
Copy link

tangbohu commented Sep 8, 2020

modify these 4 lines!delete “- 1”!
x1 = float(bbox.find('xmin').text) - 1
y1 = float(bbox.find('ymin').text) - 1
x2 = float(bbox.find('xmax').text) - 1
y2 = float(bbox.find('ymax').text) - 1

x1 = float(bbox.find('xmin').text) - 1

according to http://caffecn.cn/?/question/1055 https://stackoverflow.com/questions/38513739/warning-during-py-faster-rcnn-training-on-custom-datasets

should we delete "-1" on the experiments on VOC?

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

6 participants