Open ashencode opened 4 years ago
遇到了同样的问题,求问大神这是为什么
我也遇到了一样的问题,模型在验证集上要么就是全预测成狗,要么就全是猫
我发现把optimizer换成SGD准确度就上去了,虽然还不是很好但至少有学到东西了,但我还是不懂为何用Adam就没有效果,而且感觉Adam还要比SGD高级。之前一直在50%就等于没有学到东西,而且loss=0.69一直左右,你会发现CrossEntropyLoss = -0ln(0.5) - 1ln(0.5) = 0.69,就代表loss就是当猫狗各一半概率时候的损失,就是没学到东西!把visdom的图贴出来吧:
log:
[0223_220208]epoch:0,lr:0.001,loss:0.6930131913593837,train_cm:[[4427 4323]
[4311 4439]],val_cm:[[ 0 3750]
[ 0 3750]]
[0223_220339]epoch:1,lr:0.001,loss:0.6922840761457184,train_cm:[[2339 6411]
[1992 6758]],val_cm:[[ 769 2981]
[ 423 3327]]
[0223_220510]epoch:2,lr:0.001,loss:0.6898045110702511,train_cm:[[2723 6027]
[1945 6805]],val_cm:[[ 481 3269]
[ 201 3549]]
[0223_220641]epoch:3,lr:0.001,loss:0.6799514084134775,train_cm:[[3925 4825]
[2525 6225]],val_cm:[[ 839 2911]
[ 266 3484]]
[0223_220813]epoch:4,lr:0.001,loss:0.6653332224845891,train_cm:[[5293 3457]
[3540 5210]],val_cm:[[1547 2203]
[ 556 3194]]
[0223_220946]epoch:5,lr:0.001,loss:0.6510694112028408,train_cm:[[5892 2858]
[3738 5012]],val_cm:[[1651 2099]
[ 600 3150]]
[0223_221118]epoch:6,lr:0.001,loss:0.6366978919812621,train_cm:[[6150 2600]
[3748 5002]],val_cm:[[2737 1013]
[1203 2547]]
[0223_221251]epoch:7,lr:0.001,loss:0.6238804713283271,train_cm:[[6288 2462]
[3526 5224]],val_cm:[[2557 1193]
[ 847 2903]]
[0223_221425]epoch:8,lr:0.001,loss:0.6082892961468017,train_cm:[[6456 2294]
[3451 5299]],val_cm:[[3185 565]
[1515 2235]]
[0223_221559]epoch:9,lr:0.001,loss:0.593802088405405,train_cm:[[6535 2215]
[3275 5475]],val_cm:[[2970 780]
[1028 2722]]
I have the same question?Did anyone fix it?
其他两个模型都是正常的,但是用AlexNet,val_accuracy精度一直是 50.0,从训练开始到结束一点点波动都没有,应该是代码哪里有问题或者直接把torchvision的模型搬过来是不行的。