Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/292.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python tf.image.resize和cv2.resize:它们应该是相同的还是不同的?_Python_Tensorflow_Keras - Fatal编程技术网

Python tf.image.resize和cv2.resize:它们应该是相同的还是不同的?

Python tf.image.resize和cv2.resize:它们应该是相同的还是不同的?,python,tensorflow,keras,Python,Tensorflow,Keras,tf.image.resize中有一个臭名昭著的bug。现在我们有了tf2.0,但是我仍然不能用这个函数得到与ImageDataGenerator相同的结果 那么,这种方法是否应该与枕头和cv2中的方法相同?见详情 你希望从中得到什么样的答案?这似乎是一个应该问开发人员自己的问题,您希望从中得到什么样的答案?这似乎是一个应该问开发人员自己的问题 # we may get the same image image_tf = tf.io.read_file(str(image_path)) imag

tf.image.resize
中有一个臭名昭著的bug。现在我们有了
tf2.0
,但是我仍然不能用这个函数得到与
ImageDataGenerator
相同的结果

那么,这种方法是否应该与
枕头
cv2
中的方法相同?见详情


你希望从中得到什么样的答案?这似乎是一个应该问开发人员自己的问题,您希望从中得到什么样的答案?这似乎是一个应该问开发人员自己的问题
# we may get the same image
image_tf = tf.io.read_file(str(image_path))
image_tf = tf.image.decode_jpeg(image_tf, channels=3, dct_method='INTEGER_ACCURATE')

image_cv = cv2.imread(str(image_path))
image_cv = cv2.cvtColor(image_cv, cv2.COLOR_BGR2RGB)

np.sum(np.abs(image_cv - image_tf)) # 0

# but not the same resized image
image_tf_res = tf.image.resize(image_tf, IMAGE_SIZE, method='bilinear')
image_cv_res = cv2.resize(image_cv, tuple(IMAGE_SIZE), interpolation=cv2.INTER_LINEAR)

# this is NOT 0
np.sum(np.abs(image_cv_res - image_tf_res))