这个错误提示表明在 TensorFlow 2.x 版本中,没有名为 load_img 的函数。这可能是因为您使用了一个过时的代码,这个代码使用了 TensorFlow 1.x 版本中的函数。

要解决这个问题,您可以使用 TensorFlow2中的 tf.keras.preprocessing.image.load_img 函数来代替 tensorflow._api.v2.image.load_img 函数。 您可以这样做:

from tensorflow.keras.preprocessing.image import load_img

然后,您可以像这样调用该函数:

img = load_img('path/to/image', target_size=(224, 224))

请注意,您还需要更新其他可能使用过时 TensorFlow 函数的部分代码。

当然了什么的语句还有错误存在。需要进一步查找解决方法。

Logo

汇聚全球AI编程工具,助力开发者即刻编程。

更多推荐