测试集准确率为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)

你可能感兴趣的:(机器学习)