Reputation: 1
I visited: https://tfhub.dev/google/imagenet/resnet_v2_50/feature_vector/5
I went down to "Usage" and copied into colab:
m = tf.keras.Sequential([
hub.KerasLayer("https://tfhub.dev/google/imagenet/resnet_v2_50/feature_vector/5",
trainable=False), # Can be True, see below.
tf.keras.layers.Dense(num_classes, activation='softmax')
])
However I ran and still got this:
InvalidArgumentError Traceback (most recent call last)
<ipython-input-66-52a976264686> in <module>()
1 m = tf.keras.Sequential([
2 hub.KerasLayer("https://tfhub.dev/google/imagenet/resnet_v2_50/feature_vector/5",
----> 3 trainable=False), # Can be True, see below.
4 tf.keras.layers.Dense(num_classes, activation='softmax')
5 ])
19 frames
/usr/local/lib/python3.7/dist-packages/six.py in raise_from(value, from_value)
InvalidArgumentError: Unsuccessful TensorSliceReader constructor: Failed to get matching files on /tmp/tfhub_modules/02229962626ef521d65cf8ce349d83f59c4e3f51/variables/variables: Unimplemented: File system scheme '[local]' not implemented (file: '/tmp/tfhub_modules/02229962626ef521d65cf8ce349d83f59c4e3f51/variables/variables') [Op:Identity]
What could I have done possibly wrong? I copied it exactly, TensorFlow was also imported as tf. Many thanks for any help.
Upvotes: 0
Views: 92
Reputation:
You can execute code as shown below
import tensorflow as tf
print(tf.__version__)
import tensorflow_hub as hub
print(hub.__version__)
num_classes = 10
m = tf.keras.Sequential([
hub.KerasLayer("https://tfhub.dev/google/imagenet/resnet_v2_50/feature_vector/5",
trainable=False), # Can be True, see below.
tf.keras.layers.Dense(num_classes, activation='softmax')
])
m.build([None, 224, 224, 3]) # Batch input shape.
m.summary()
Output:
2.6.0
0.12.0
Model: "sequential"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
keras_layer_1 (KerasLayer) (None, 2048) 23564800
_________________________________________________________________
dense (Dense) (None, 10) 20490
=================================================================
Total params: 23,585,290
Trainable params: 20,490
Non-trainable params: 23,564,800
_________________________________________________________________
Upvotes: 1