测试集准确率为NAN

  • Post author:
  • Post category:其他


进行模型校验时,模型评估测试集准确率为nan,如下

nan

/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/numpy/core/fromnumeric.py:3118: RuntimeWarning: Mean of empty slice.

out=out, **kwargs)

/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/numpy/core/_methods.py:85: RuntimeWarning: invalid value encountered in double_scalars

ret = ret.dtype.type(ret / rcount)

经查,原来是测试集数据量太少,而我们设置batch_size时,设置的数值大于测试集的数据数量。

解决方法,把drop_last由True改为False

eval_reader = paddle.batch(custom_reader(eval_list_path),
                            batch_size=batch_size,
                            drop_last=False)



版权声明:本文为weixin_42076509原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。