测试集准确率为NAN

进行模型校验时,模型评估测试集准确率为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)
发布了9 篇原创文章 · 获赞 8 · 访问量 771

猜你喜欢

转载自blog.csdn.net/weixin_42076509/article/details/105320854