Python Keras:再处理如何缩放图像?

Python Keras:再处理如何缩放图像?,python,tensorflow,keras,deep-learning,Python,Tensorflow,Keras,Deep Learning,为了从磁盘加载图像数据,Keras提供了tf.Keras.preprocessing.image\u dataset\u from_directory()方法,该方法在上有说明。 我想使用此方法加载数据以生成图像分类器。 包含有关如何最佳组织数据的一些信息 来自目录()的image\u dataset\u使用一个强制参数image\u size=(…,…)将所有图像设置为相同的大小(这是后续步骤所必需的)。 在哪里可以找到有关图片缩放方式的详细信息? 具有极端比率的图片是否会失真并对分类程序产生

为了从磁盘加载图像数据,Keras提供了
tf.Keras.preprocessing.image\u dataset\u from_directory()
方法,该方法在上有说明。 我想使用此方法加载数据以生成图像分类器。 包含有关如何最佳组织数据的一些信息

来自目录()的
image\u dataset\u
使用一个强制参数
image\u size=(…,…)
将所有图像设置为相同的大小(这是后续步骤所必需的)。
在哪里可以找到有关图片缩放方式的详细信息?

具有极端比率的图片是否会失真并对分类程序产生负面影响?

我无法找到调整大小的具体方法。然而,它可能使用cv2中列出的方法之一,但我不知道是哪一种

[optional] flag that takes one of the following methods. INTER_NEAREST – a nearest-neighbor interpolation INTER_LINEAR – a bilinear interpolation (used by default) INTER_AREA – resampling using pixel area relation. It may be a preferred method for image decimation, as it gives moire’-free results. But when the image is zoomed, it is similar to the INTER_NEAREST method. INTER_CUBIC – a bicubic interpolation over 4×4 pixel neighborhood INTER_LANCZOS4 – a Lanczos interpolation over 8×8 pixel neighborhood

当然,调整大小后,图像会失真。我做了很多图像分类,并没有发现这是一个问题。除此之外,似乎别无选择,只能让所有图像大小相同。

我无法找到调整大小的具体方法。然而,它可能使用cv2中列出的方法之一,但我不知道是哪一种

[optional] flag that takes one of the following methods. INTER_NEAREST – a nearest-neighbor interpolation INTER_LINEAR – a bilinear interpolation (used by default) INTER_AREA – resampling using pixel area relation. It may be a preferred method for image decimation, as it gives moire’-free results. But when the image is zoomed, it is similar to the INTER_NEAREST method. INTER_CUBIC – a bicubic interpolation over 4×4 pixel neighborhood INTER_LANCZOS4 – a Lanczos interpolation over 8×8 pixel neighborhood

当然,调整大小后,图像会失真。我做了很多图像分类,并没有发现这是一个问题。除此之外,似乎别无选择,只能让所有图像的大小相同。

它使用任何一种。您可以在Tensorflow中找到源代码。

它使用以下任何一种方法。您可以在Tensorflow中找到源代码。

Hi Gerry,谢谢您的回答。知道Keras使用cv2已经很有帮助了。我不认为Keras使用cv2。我提到它是因为它说明了调整大小方法的类型。嗨,Gerry,谢谢你的回答。知道Keras使用cv2已经很有帮助了。我不认为Keras使用cv2。我之所以提到它,是因为它说明了调整大小方法的类型。