gpt4 book ai didi

tensorflow - tf2.1第二次训练如何使用tfhub提供的efficientnet-lite

转载 作者:行者123 更新时间:2023-12-03 17:25:36 27 4
gpt4 key购买 nike

我使用的版本是 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())
当我设置 trainable = True ,操作会报错。
那么,我不能在 tf2.1 版本上重新训练它吗?

最佳答案

TFHub 上的 EfficientNet-Lite 模型基于 TensorFlow 1,因此受到 TF2 的许多限制,包括您发现的微调。 EfficientNet 模型已更新到 TF2,但我们仍在等待它们的 lite 版本。
https://www.tensorflow.org/hub/model_compatibility
https://github.com/tensorflow/hub/issues/751

关于tensorflow - tf2.1第二次训练如何使用tfhub提供的efficientnet-lite,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61335622/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com