在使用 Keras 的图像预处理模块中的 'affine_transform' 函数时,可能会遇到 'NameError: name 'ndimage' is not defined' 的错误。这是因为 'affine_transform' 函数依赖于 'scipy.ndimage' 模块,而该模块并没有被默认导入。

为了解决这个问题,可以在代码中添加以下代码来导入 'ndimage' 模块:

from scipy import ndimage

添加完代码后,重新运行代码即可解决问题。

Keras 图像预处理中 'affine_transform' 函数报错: 'ndimage' 未定义

原文地址: https://www.cveoy.top/t/topic/ojTM 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录