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

关于BN和model.eval()的问题 #73

Closed
luoshuifeiyang opened this issue Nov 20, 2020 · 2 comments
Closed

关于BN和model.eval()的问题 #73

luoshuifeiyang opened this issue Nov 20, 2020 · 2 comments

Comments

@luoshuifeiyang
Copy link

作者您好,我在拜读并测试过您的代码后有几点问题想要请教一下:
在训练时,您使用的是model.eval()而非model.train(),为什么要这么做呢?我了解到,model.eval()会使BN失去作用,那么这样的话,是不是deeplab_resnet中的BN层其实并没有作用呢?之后,我将model.eval()换成了model.train()进行训练,最终训练出的模型效果不如用model.eval()好,我很迷惑,能请您解释一下原因吗?
谢谢作者。

@backseason
Copy link
Owner

backseason commented Nov 20, 2020 via email

@luoshuifeiyang
Copy link
Author

eval的目的就是为了freeze backbone中bn的参数,因为目标数据集比较小,分布没有原来的imagenet均匀,所以freeze bn的效果会稍好一些。 luoshuifeiyang notifications@github.com 于2020年11月20日周五 下午2:15写道:

作者您好,我在拜读并测试过您的代码后有几点问题想要请教一下: 在训练时,您使用的是model.eval()而非model.train(),为什么要这么做呢?我了解到,model.eval()会使BN失去作用,那么这样的话,是不是deeplab_resnet中的BN层其实并没有作用呢?之后,我将model.eval()换成了model.train()进行训练,最终训练出的模型效果不如用model.eval()好,我很迷惑,能请您解释一下原因吗? 谢谢作者。 — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#73>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYO2OD3VGMLU4B6OHOIXQLSQYCQXANCNFSM4T4LFXUA .
-- From BackSeason-刘姜江 Major in Computer Science and Technology Nankai University, Tianjin,300350 P.R.China J04.liu@gmail.com j04.liu@gmail.com

谢谢您

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