System info: Python: 3.6.9 Tensorflow: 2.2.0 CPU package from pip
The issue:
I got https://tfhub.dev/google/imagenet/resnet_v2_50/classification/4?tf-hub-format=compressed from tf-hub and then uncompressed in a new directory.
wget https://storage.googleapis.com/tfhub-modules/google/imagenet/resnet_v2_50/feature_vector/4.tar.gz
mkdir test_pb
mv 4.tar.gz test_pb
cd test_pb
tar -xvf 4.tar.gz
rm 4.tar.gz
cd ..
./test.py
https://storage.googleapis.com/tfhub-modules/google/imagenet/resnet_v2_50/feature_vector/4.tar.gz is the feature vector pre-trained model from https://tfhub.dev/google/imagenet/resnet_v2_50/feature_vector/4 in tf-hub.
test.py is the Python script, and this following is the standalone code:
#!/usr/bin/env python3
from __future__ import absolute_import, division, print_function, unicode_literals
import os
import tensorflow as tf
print(tf.__version__)
resnet50v2_save_path = os.path.join('.', "./test_pb/")
loaded1 = tf.keras.models.load_model(resnet50v2_save_path)
print("Load done")
print("Signatures: ", loaded1.signatures)
print("Type: ", type(loaded1))
print(loaded1.summary())
that give this output:
2.2.0
2020-06-12 20:29:07.677555: I tensorflow/core/platform/profile_utils/cpu_utils.cc:102] CPU Frequency: 1995455000 Hz
2020-06-12 20:29:07.678219: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x59eb130 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-06-12 20:29:07.678241: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
Load done
Signatures: _SignatureMap({})
Type: <class 'tensorflow.python.saved_model.load.Loader._recreate_base_user_object.<locals>._UserObject'>
Traceback (most recent call last):
File "./test.py", line 18, in <module>
print(loaded1.summary())
AttributeError: '_UserObject' object has no attribute 'summary'
that is the mentioned error.
Why?
Thx