che*_*ang 5 tensorflow tensorflow-hub
我使用的版本是 tensorflow-gpu 版本 2.1.0,从 pip 安装。
import tensorflow as tf
import tensorflow_hub as hub
tf.keras.backend.set_learning_phase(True)
module_url = "https://tfhub.dev/tensorflow/efficientnet/lite0/classification/2"
module2 = tf.keras.Sequential([
hub.KerasLayer(module_url, trainable=False, input_shape=(224,224,3))])
output1 = module2(tf.ones(shape=(1,224,224,3)))
print(module2.summary())
Run Code Online (Sandbox Code Playgroud)
当我设置时trainable = True,操作会报错。那么,我不能在 tf2.1 版本上重新训练它吗?
TFHub 上的 EfficientNet-Lite 模型基于 TensorFlow 1,因此受到 TF2 的许多限制,包括您所发现的微调。EfficientNet 模型已更新为 TF2,但我们仍在等待其精简版本。
https://www.tensorflow.org/hub/model_compatibility
https://github.com/tensorflow/hub/issues/751
更新:从 2021 年 10 月 5 日开始,TFHub 上的 EfficientNet-Lite 模型可用于 TensorFlow 2。
| 归档时间: |
|
| 查看次数: |
510 次 |
| 最近记录: |