AttributeError: module 'tensorflow.io' has no attribute 'experimental'
AttributeError: module 'tensorflow.io' has no attribute 'experimental'
我正在尝试从 tensorflow 调用一个函数来解码 tiff 图像,而我 运行 kaggle notebooks 上的笔记本和这一行:
img = tfio.experimental.image.decode_tiff(img, channels=1)
它给我错误:
AttributeError: in user code:
<ipython-input-5-d30698f56813>:11 load *
img = tfio.experimental.image.decode_tiff(img, channels=1)
AttributeError: module 'tensorflow.io' has no attribute 'experimental'
我目前正在像这样导入 tensorflow.io:
import tensorflow.io as tfio
而我当前的版本:print(f"Tensorflow ver. {tf.__version__}")
是
Tensorflow ver. 2.3.0
TensorflowI/O没有自带Tensorflow,必须通过pip
单独安装;来自 repo(强调我的):
TensorFlow I/O is a collection of file systems and file formats that are not available in TensorFlow's built-in support.
而且不是那样导入的
你应该做的是通过 pip
:
安装它
!pip install tensorflow-io
并确认您获得的是最新版本 v0.15.0,因为它是目前唯一与 TF 2.3 兼容的版本 (source):
import tensorflow_io as tfio
tfio.__version__
# 0.15.0
注意不同的导入 - tensorflow_io
、不是 tensorflow.io
; Github.
中的简单用法示例也证明了这一点
我正在尝试从 tensorflow 调用一个函数来解码 tiff 图像,而我 运行 kaggle notebooks 上的笔记本和这一行:
img = tfio.experimental.image.decode_tiff(img, channels=1)
它给我错误:
AttributeError: in user code:
<ipython-input-5-d30698f56813>:11 load * img = tfio.experimental.image.decode_tiff(img, channels=1) AttributeError: module 'tensorflow.io' has no attribute 'experimental'
我目前正在像这样导入 tensorflow.io:
import tensorflow.io as tfio
而我当前的版本:print(f"Tensorflow ver. {tf.__version__}")
是
Tensorflow ver. 2.3.0
TensorflowI/O没有自带Tensorflow,必须通过pip
单独安装;来自 repo(强调我的):
TensorFlow I/O is a collection of file systems and file formats that are not available in TensorFlow's built-in support.
而且不是那样导入的
你应该做的是通过 pip
:
!pip install tensorflow-io
并确认您获得的是最新版本 v0.15.0,因为它是目前唯一与 TF 2.3 兼容的版本 (source):
import tensorflow_io as tfio
tfio.__version__
# 0.15.0
注意不同的导入 - tensorflow_io
、不是 tensorflow.io
; Github.