无法从keras.preprocessing.image导入apply_transform [英] Can't import apply_transform from keras.preprocessing.image

查看:456
本文介绍了无法从keras.preprocessing.image导入apply_transform的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在从keras.preprocessing.image导入apply_transform时遇到问题.据我所知,根据Keras文档,名称没有更改.任何人都不知道可能是什么问题.我可以从同一个库导入例如ImageDataGenerator.

I have been having issues importing apply_transform from keras.preprocessing.image. As far as I know the name has not changed according to Keras documentation. Anyone has any idea what might be the issue. I can, from the same library, import ImageDataGenerator for instance.

推荐答案

apply_transform 已重构作为ImageDataGenerator类的方法之一.相反,您可以定义ImageDataGenerator类的实例并使用它:

apply_transform has been removed from image module and has been refactored as one of the methods of ImageDataGenerator class. Instead you can define an instance of ImageDataGenerator class and use it:

from keras.preprocessing.image import ImageDataGenerator

img_gen = ImageDataGenerator()
img_gen.apply_transform(args)

或者您可以使用 apply_affine_transform() keras.preprocessing.image模块中的方法满足您的需求.

or you can use apply_affine_transform() method from keras.preprocessing.image module if it satisfies your needs.

我认为你是对的. 文档对此有误:

And I think you are right. The documentation is wrong about this:

keras.preprocessing.image.apply_transform(x, transform_parameters)

应为:

apply_transform(x, transform_parameters)

这篇关于无法从keras.preprocessing.image导入apply_transform的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆