![](/img/trans.png)
[英]Validation set only gets images from one class when using keras ImageDataGenerator flow_from_dataframe
[英]Keras: how to disable resizing of images when using an ImageDataGenerator with flow_from_dataframe / flow_from_directory?
我试图通过使用 ImageDataGenerator 并将自定义函数传递给preprocessing_function
参数来对我的图像应用一些裁剪操作。 但是,根据 Keras 文档,此功能只会在图像已调整大小后运行:
preprocessing_function :将隐含在每个输入上的函数。 该函数将在图像调整大小和增强后运行。
现在我想禁用调整大小,但是如果没有提供值,则 target_size 参数默认为 (256,256)。 再次来自文档:
target_size :整数元组(高度、宽度),默认值:(256, 256)。 找到的所有图像的尺寸将被调整。
我一直在尝试将target_size
参数设置为None
,但这会导致错误:
TypeError: 'NoneType' object cannot be interpreted as an integer
在我的情况下,裁剪已经调整大小的图像会产生错误的结果。 因此,我正在寻找一种方法,以防止调整大小发生或仅在应用我的自定义预处理功能后发生。 如果不编写整个自定义数据生成器,这可能吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.