BUG: fluid.layers.accuracy not work correctly
Created by: parap1uie-s
System information -PaddlePaddle version: 1.5.1, GPU -GPU: including CUDA 9.0 /cuDNN 7.6 -OS Platform and Distribution Ubuntu 16.04 -Python version: 3.6.5
fluid.layers.accuracy() gives a wrong answer when model output shape is [bs, 1].
When the binary classification model with fc(size=1) and activated by sigmoid, the accuracy() op will gives a wrong answer:
obviously, acc should not be 1.0. 0.1 is fine.
问题描述:
现在accuracy的实现方法,是对input沿行方向取argmax后,取得最大概率下标,与稠密的label进行比对。
但当input的类别维度为1时,argmax结果显然恒为0。因此accuracy的取值将由label中0的占比来决定,而不是真正的“正确率”