使用tensorflow进行FCN网络训练时出现loss值是负值情况1

简单的FCN网络出现结果如下:

epoch=0,i=54747 of 78989, loss=-624.140625
epoch=0,i=54748 of 78989, loss=-739.443359
epoch=0,i=54749 of 78989, loss=-603.046875
epoch=0,i=54750 of 78989, loss=-594.843750
epoch=0,i=54751 of 78989, loss=-509.031250
epoch=0,i=54752 of 78989, loss=-656.093750
epoch=0,i=54753 of 78989, loss=-725.562500
epoch=0,i=54754 of 78989, loss=-589.484375
epoch=0,i=54755 of 78989, loss=-691.789062
epoch=0,i=54756 of 78989, loss=-123.398438
epoch=0,i=54757 of 78989, loss=-561.562500
epoch=0,i=54758 of 78989, loss=-554.531250
epoch=0,i=54759 of 78989, loss=-557.578125
epoch=0,i=54760 of 78989, loss=-543.281250
epoch=0,i=54761 of 78989, loss=-592.968750

经过验证,是softmax与sigmoid函数选择不恰当,本人做的是两分类,换成sigmoid函数计算loss之后,发现所有的loss值固定为一个数,在此之前deconv是没有加入bias的,当最后加入bias训练之后,得到的结果如下所示:

epoch=7,i=57416 of 78989, loss=-44566832.000000
epoch=7,i=57417 of 78989, loss=-27127590.000000
epoch=7,i=57418 of 78989, loss=-27127606.000000
epoch=7,i=57419 of 78989, loss=-33217624.000000
epoch=7,i=57420 of 78989, loss=-35709012.000000
epoch=7,i=57421 of 78989, loss=-45951332.000000
epoch=7,i=57422 of 78989, loss=-29065516.000000

去掉bias之后,结果如下

epoch=0,i=22875 of 78989, loss=798.504578
epoch=0,i=22876 of 78989, loss=798.504578
epoch=0,i=22877 of 78989, loss=798.504578
epoch=0,i=22878 of 78989, loss=798.504578
epoch=0,i=22879 of 78989, loss=798.504578
epoch=0,i=22880 of 78989, loss=798.504578
epoch=0,i=22881 of 78989, loss=798.504578
epoch=0,i=22882 of 78989, loss=798.504578

固定为一个值不动,经过重新试验,我将fcn网络的最后一层的softmax改为了sigmoid函数之后,结果如下:

epoch=6,i=693 of 78989, loss=798.504578
epoch=6,i=694 of 78989, loss=798.504578
epoch=6,i=695 of 78989, loss=798.504578
epoch=6,i=696 of 78989, loss=798.504578
epoch=6,i=697 of 78989, loss=798.504578
epoch=6,i=698 of 78989, loss=798.504578

还是固定为同一个值不变,可能陷入局部最优解,将学习率从0.0001调整为0.001之后,结果如下所示:

epoch=6,i=696 of 78989, loss=798.504578
epoch=6,i=697 of 78989, loss=798.504578
epoch=6,i=698 of 78989, loss=798.504578

继续调整学习率到0.01,结果不变。即跟学习率无关。

继续探索原因,后续会补上结果。

 

 

 

 

 

你可能感兴趣的:(深度学习,python,tensorflow,fcn)