bubbliiiing / faster-rcnn-pytorch

这是一个faster-rcnn的pytorch实现的库,可以利用voc数据集格式的数据进行训练。
MIT License
1.52k stars 350 forks source link

改了模型结构之后loss特别大,也降不下去 #85

Open elory-y opened 2 years ago

elory-y commented 2 years ago

你好,我在backbone之后又增加了一个特征提取的模块,所以voc_weight_resnet的权重就用不了了,然后我使用了Resnet50的预训练权重,损失达到了10的33次方,调大学习率,调整学习率更新的方式也降不下去,请问是什么原因?有没有什么建议?谢谢

bubbliiiing commented 2 years ago

……我觉得你特征提取的模块可能有点问题啊兄弟

dogdogpee commented 2 years ago

我是只加载backbone在ImageNet上与训练的参数时也遇到了loss ~10^35的情况。把train.py里的

if pretrained:
        weights_init(model)

注释掉就好了.否则此段代码重置所有网络参数,加载的与训练参数就用不上了.

bubbliiiing commented 2 years ago

应该是if not pretrain的……我的问题

dogdogpee commented 2 years ago

改过来后虽然不爆炸,但在行人数据集上算的 train loss 只降了10%就开始波动了😭不知道咋回事 难道是因为我把resnet layer4也算到extractor里了,classifier只保留了avgpool?

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Bubbliiiing @.> Sent: Monday, November 15, 2021 12:49:05 AM To: bubbliiiing/faster-rcnn-pytorch @.> Cc: Yuan, Jing @.>; Comment @.> Subject: Re: [bubbliiiing/faster-rcnn-pytorch] 改了模型结构之后loss特别大,也降不下去 (Issue #85)

This email from @.*** originates from outside Imperial. Do not click on links and attachments unless you recognise the sender. If you trust the sender, add them to your safe senders listhttps://spam.ic.ac.uk/SpamConsole/Senders.aspx to disable email stamping for this address.

应该是if not pretrain的……我的问题

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/bubbliiiing/faster-rcnn-pytorch/issues/85#issuecomment-968326005, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AH3M4BNIC4LH6P2Y3P47JQTUL7SADANCNFSM5HZ2FDRQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

bubbliiiing commented 2 years ago

你没改过的代码损失大概多少,现在多少?

dogdogpee commented 2 years ago

没改时总的train loss是10^35,且不下降。改了以后第一个epoch的总train loss大约1.x,迭代三四十个epoch后在1.0震荡

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Bubbliiiing @.> Sent: Monday, November 15, 2021 1:00:44 AM To: bubbliiiing/faster-rcnn-pytorch @.> Cc: Yuan, Jing @.>; Comment @.> Subject: Re: [bubbliiiing/faster-rcnn-pytorch] 改了模型结构之后loss特别大,也降不下去 (Issue #85)

This email from @.*** originates from outside Imperial. Do not click on links and attachments unless you recognise the sender. If you trust the sender, add them to your safe senders listhttps://spam.ic.ac.uk/SpamConsole/Senders.aspx to disable email stamping for this address.

你没改过的代码损失大概多少,现在多少?

― You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/bubbliiiing/faster-rcnn-pytorch/issues/85#issuecomment-968327815, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AH3M4BNLWPKDIZDQVLRVEJLUL7TLZANCNFSM5HZ2FDRQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

bubbliiiing commented 2 years ago

我说的是……如果直接下我这个代码,不做修改,用我提供的预训练

dogdogpee commented 2 years ago

是指load全模型预训练参数,然后freeze backbone训练吗?我还没试过这个诶 。你的意思是rpn参数初始化可能有问题?

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Bubbliiiing @.> Sent: Monday, November 15, 2021 1:06:13 AM To: bubbliiiing/faster-rcnn-pytorch @.> Cc: Yuan, Jing @.>; Comment @.> Subject: Re: [bubbliiiing/faster-rcnn-pytorch] 改了模型结构之后loss特别大,也降不下去 (Issue #85)

This email from @.*** originates from outside Imperial. Do not click on links and attachments unless you recognise the sender. If you trust the sender, add them to your safe senders listhttps://spam.ic.ac.uk/SpamConsole/Senders.aspx to disable email stamping for this address.

我说的是……如果直接下我这个代码,不做修改,用我提供的预训练

― You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/bubbliiiing/faster-rcnn-pytorch/issues/85#issuecomment-968328708, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AH3M4BOINLOQUEWZBTYFPV3UL7UALANCNFSM5HZ2FDRQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

bubbliiiing commented 2 years ago

是的。最好还是试一下,我觉得可能整个修改有点问题😂

xexiyong commented 2 years ago

梳理代码,看到if pretrained这句,咋看感觉不对劲,还真有这bug啊

bubbliiiing commented 2 years ago

是的