【问题标题】:How to import the module apply_transform or replace it by other?如何导入模块 apply_transform 或替换为其他模块?
【发布时间】:2019-09-04 18:37:24
【问题描述】:

我无法导入 apply_transform 和 transform_matrix_offset_center。 我尝试使用ImageDataGenerator,但我也遇到了问题!

from keras.preprocessing.image import apply_transform, transform_matrix_offset_center

ImportError: 无法导入名称“apply_transform”

【问题讨论】:

    标签: python matrix keras transform


    【解决方案1】:

    这取决于您运行的是哪个版本的 keras。根据这个Github-issue,关于文档有一点混乱。这个post 解决了您对apply_transform 的最新版本问题。在我的 Keras 版本 (2.1.5) 中,from keras.preprocessing.image import apply_transform 有效,但在前面提到的帖子中解释的更高版本中,apply_transform 已移至ImageDataGenerator

    至于transform_matrix_offset_center,基于keras.preprocessing.image 的源代码,line 21 很清楚这个from keras.preprocessing.image import transform_matrix_offset_center 应该可以工作。你可以参考releases-timeline了解每个版本的不同变化

    【讨论】:

    • 很高兴我能帮上忙 :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-03
    • 2020-01-28
    • 1970-01-01
    相关资源
    最近更新 更多