V3EX
注册 登录
V3EX  ›  程序员

请教: 同一份 Tensorflow 代码,训练新闻自动分类, Windows 和 Linux 下的训练结果不一致?

suley  •  280 天前  •  4533 次点击  

我是参考这位兄弟的文章练习的,只不过我的环境换成了 Ubuntu,

https://www.jianshu.com/p/db8824205fc3

根据这位博主的测试,第一千步就差不多能达到 90%准确率。

step:100 loss:1.5357 accuracy:0.4900
step:200 loss:1.0189 accuracy:0.7000
step:300 loss:0.7720 accuracy:0.7850
step:400 loss:0.6589 accuracy:0.8000
step:500 loss:0.4987 accuracy:0.8300
step:600 loss:0.5863 accuracy:0.8100
step:700 loss:0.5242 accuracy:0.8350
step:800 loss:0.3541 accuracy:0.9000
step:900 loss:0.5004 accuracy:0.8700
step:1000 loss:0.3152 accuracy:0.9050

可是我训练了差不多一百万步,始终在 0.3~0.4 徘徊,不收敛,里面有些大小写的错误我都修正了,还是不得要领。

我的训练结果:

step:100 loss:2.2414 accuracy:0.2250 used time: 3 s
step:200 loss:2.0146 accuracy:0.3450 used time: 7 s
step:300 loss:1.9829 accuracy:0.2900 used time: 11 s
step:400 loss:1.8127 accuracy:0.3350 used time: 15 s
step:500 loss:1.9361 accuracy:0.3150 used time: 19 s
step:600 loss:1.8108 accuracy:0.3300 used time: 23 s
step:700 loss:1.7482 accuracy:0.3950 used time: 27 s
step:800 loss:1.7227 accuracy:0.3200 used time: 31 s
step:900 loss:1.7529 accuracy:0.3500 used time: 35 s
step:1000 loss:1.7124 accuracy:0.3300 used time: 38 s
step:1100 loss:1.7832 accuracy:0.3350 used time: 42 s
step:1200 loss:1.7278 accuracy:0.3500 used time: 46 s
step:1300 loss:1.6402 accuracy:0.3000 used time: 50 s
step:1400 loss:1.6699 accuracy:0.3200 used time: 54 s
step:1500 loss:1.6819 accuracy:0.3600 used time: 59 s
step:1600 loss:1.7417 accuracy:0.3400 used time: 63 s
step:1700 loss:1.7227 accuracy:0.3350 used time: 67 s
step:1800 loss:1.6762 accuracy:0.3850 used time: 71 s
step:1900 loss:1.6828 accuracy:0.3150 used time: 75 s
step:2000 loss:1.6694 accuracy:0.2900 used time: 79 s
step:2100 loss:1.6974 accuracy:0.2950 used time: 83 s
step:2200 loss:1.6517 accuracy:0.3450 used time: 87 s
step:2300 loss:1.6009 accuracy:0.3600 used time: 91 s
step:2400 loss:1.7358 accuracy:0.3300 used time: 95 s
step:2500 loss:1.7149 accuracy:0.3500 used time: 99 s
step:2600 loss:1.6166 accuracy:0.3850 used time: 103 s
step:2700 loss:1.6242 accuracy:0.3500 used time: 107 s
step:2800 loss:1.6648 accuracy:0.3550 used time: 111 s
step:2900 loss:1.6295 accuracy:0.3050 used time: 115 s
step:3000 loss:1.6616 accuracy:0.3400 used time: 119 s

联系了博主,博主表示检查了很久也不知道为什么会这样。而且同一篇文章下也有其它网友说遇到了同样的问题。

请教下各位大神~先谢过了。

1 回复

git push -f