[英]AttributeError: module 'tensorflow.keras.models' has no attribute 'experimental'
[英]AttributeError: module 'tensorflow.io' has no attribute 'experimental'
我正在嘗試從 tensorflow 調用 function 來解碼 tiff 圖像,同時我在 kaggle 筆記本上運行筆記本並在這一行中:
img = tfio.experimental.image.decode_tiff(img, channels=1)
它給了我錯誤:
AttributeError:在用戶代碼中:
<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 版本。 2.3.0
Tensorflow I/O Tensorflow沒有自帶,必須通過pip
單獨安裝; 來自回購協議(強調我的):
TensorFlow I/O 是 TensorFlow 內置支持中沒有的文件系統和文件格式的集合。
而且,它不是那樣導入的。
你應該做的是通過pip
安裝它:
!pip install tensorflow-io
並驗證您是否獲得了最新版本 v0.15.0,因為它是目前唯一與 TF 2.3 兼容的版本( 來源):
import tensorflow_io as tfio
tfio.__version__
# 0.15.0
注意不同的 import- tensorflow_io
,而不是tensorflow.io
; Github中的簡單用法示例也對此進行了演示。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.