看到了一个关于tf.image.resize函数的警告,吓死我了 ,不管啥时候能用到,我赶紧存一下。

这是一个对所有计算机视觉工作者的简短警告:请勿使用任何tf.image.resize函数!
该代码实际将你的图像向左和向上移动一个像素,这个破坏过程甚至在插值中。这是2018年,很难想象这是TensorFlow对缩小尺度的结果。
 无论你偏好什么样的图像处理过程,坚持使用Scipy/OpenCV/numpy/PIL。当我改变了这部分代码,我的网络焕发出了魅力(当我看到训练结果时,实际上是第二天)。

resized = tf.image.resize_images(image,H, W, method=0)

新版resize_images函数改为:

resized = tf.image.resize_images(image, size=[H,W], method=0)

image:shape 为[batch, height, width, channels]的4-D图像张量或者shape为 [height, width, channels]的3-D图像张量

1.双线性插值算法(Bilinear interpolation);Method取值为:0;

2.最近邻居法(Nearest  neighbor interpolation);Method取值为:1;

3.双三次插值法(Bicubic interpolation);Method取值为:2;

4.面积插值法(Area interpolation) ;Method取值为:3;

猜你喜欢

转载自blog.csdn.net/m0_37644085/article/details/83276327