Pat*_*ick 5 python-3.x tensorflow
我正在关注带有 tensorflow 1.14 的 Keras教程集线器。我没有 pip install tf-nightly-gpu 因为它似乎不适用于 MacOS。一切顺利,直到 keras.Sequential() :
import tensorflow_hub as hub
from tensorflow.keras import layers
classifier_url ="https://tfhub.dev/google/imagenet/resnet_v2_50/feature_vector/3"
IMAGE_SHAPE = (224, 224)
classifier = tf.keras.Sequential([
hub.KerasLayer(classifier_url, input_shape=IMAGE_SHAPE+(3,))
])
Run Code Online (Sandbox Code Playgroud)
最后一行给出以下错误:
ValueError: Importing a SavedModel with tf.saved_model.load requires a 'tags=' argument if there is more than one MetaGraph. Got 'tags=None', but there are 2 MetaGraphs in the SavedModel with tag sets [[], ['train']]. Pass a 'tags=' argument to load this SavedModel.
Run Code Online (Sandbox Code Playgroud)
它与tensorflow版本有关还是与其他东西有关?
MacOS High Sierra 10.13.1 python 3.6.8 tensorflow 1.14.0
这在 TF 1.14.0 中对我有用:
# Image information
HEIGHT = 224
WIDTH = 224
CHANNELS = 3
IMAGE_SHAPE = (HEIGHT, WIDTH)
feature_extractor_url = "https://tfhub.dev/google/imagenet/resnet_v2_50/feature_vector/3" #@param {type:"string"}
module = hub.Module(feature_extractor_url, tags=['train'])
feature_extractor_layer = hub.KerasLayer(module,
input_shape=(HEIGHT, WIDTH, CHANNELS))
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2598 次 |
| 最近记录: |