keras - flow_from_directory 函数 - target_size 参数

edn*_*edn 5 artificial-intelligence machine-learning neural-network conv-neural-network keras

Keras 有一个名为 flow_from_directory 的函数,其中一个参数称为 target_size。这是它的解释:

target_size: Tuple of integers (height, width), default: (256, 256). 
The dimensions to which all images found will be resized.
Run Code Online (Sandbox Code Playgroud)

我不清楚的是它是否只是将原始图像裁剪成 256x256 矩阵(在这种情况下我们不拍摄整个图像)或者只是降低图像的分辨率(同时仍然向我们显示整个图像) ?

如果是 - 比方说 - 只需降低分辨率:假设我有一些尺寸为 1024x1024 的 X 射线图像(用于乳腺癌检测)。如果我想将迁移学习应用于仅接受 224x224 输入图像的预训练卷积神经网络,当我将图像的大小(和分辨率)从 1024x1024 减小到 224x224 时,我不会丢失重要的数据/信息吗?难道就没有这样的风险吗?

先感谢您!

Ref*_*Jan 4

  1. 降低分辨率(增大)
  2. 是的,您正在丢失数据

最好的方法是重建 CNN 以使用原始图像大小,即 1024*1024