解决numpy 和 tensorflow处理数据时精度不一致问题
原因可能与tf.reduce_mean有关,具体见 https://github.com/tensorflow/tensorflow/issues/12387 https://github.com/tensorflow/tensorflow/issues/5527
时间有限没有深究,暂时的解决方法是 tensorflow数据处理过程改为tf.float64, numpy的数据处理过程也改为np.float64
tensorflow 数据处理部分代码如下
#image = tf.to_float(image)
image = tf.to_double(image)
# Resize and crop if needed.
resized_image = tf.image.resize_image_with_crop_or_pad(image,
output_width,
output_height)
# Subtract off the mean and divide by the variance of the pixels.
norm_image