当我试图从tensorflow hub呼吸中心获取模型时。
我可以将其视为保存的模型格式,但我无法访问模型架构以及每个层的权重存储。
import tensorflow_hub as hub
model = hub.load("https://tfhub.dev/tensorflow/centernet/hourglass_512x512/1")
)
有没有正式的方法来处理它?
我能通过的所有属性
model.__dict__
对于原始模型中的特定图层不清楚。
{'_self_setattr_tracking': True,
'_self_unconditional_checkpoint_dependencies': [TrackableReference(name='_model', ref=<tensorflow.python.saved_model.load.Loader._recreate_base_user_object.<locals>._UserObject object at 0x7fe4e4914710>),
TrackableReference(name='signatures', ref=_SignatureMap({'serving_default': <ConcreteFunction signature_wrapper(input_tensor) at 0x7FE4E601F210>})),
TrackableReference(name='_self_saveable_object_factories', ref=DictWrapper({}))],
'_self_unconditional_dependency_names': {'_model': <tensorflow.python.saved_model.load.Loader._recreate_base_user_object.<locals>._UserObject at 0x7fe4e4914710>,
'signatures': _SignatureMap({'serving_default': <ConcreteFunction signature_wrapper(input_tensor) at 0x7FE4E601F210>}),
'_self_saveable_object_factories': {}},
'_self_unconditional_deferred_dependencies': {},
'_self_update_uid': 176794,
'_self_name_based_restores': set(),
'_self_saveable_object_factories': {},
'_model': <tensorflow.python.saved_model.load.Loader._recreate_base_user_object.<locals>._UserObject at 0x7fe4e4914710>,
'signatures': _SignatureMap({'serving_default': <ConcreteFunction signature_wrapper(input_tensor) at 0x7FE4E601F210>}),
'__call__': <tensorflow.python.saved_model.function_deserialization.RestoredFunction at 0x7fe315a28950>,
'graph_debug_info': ,
'tensorflow_version': '2.4.0',
'tensorflow_git_version': 'unknown'}
我也试过了
model.signatures['serving_default'].__dict__
,表示每个层的张量不可见
[<tf.Tensor: shape=(), dtype=resource, numpy=<unprintable>>,
<tf.Tensor: shape=(), dtype=resource, numpy=<unprintable>>,
<tf.Tensor: shape=(), dtype=resource, numpy=<unprintable>>,
<tf.Tensor: shape=(), dtype=resource, numpy=<unprintable>>,
<tf.Tensor: shape=(), dtype=resource, numpy=<unprintable>>,
<tf.Tensor: shape=(), dtype=resource, numpy=<unprintable>>,
<tf.Tensor: shape=(), dtype=resource, numpy=<unprintable>>,
<tf.Tensor: shape=(), dtype=resource, numpy=<unprintable>>,
<tf.Tensor: shape=(), dtype=resource, numpy=<unprintable>>,
<tf.Tensor: shape=(), dtype=resource, numpy=<unprintable>>,
<tf.Tensor: shape=(), dtype=resource, numpy=<unprintable>>,
<tf.Tensor: shape=(), dtype=resource, numpy=<unprintable>>,
<tf.Tensor: shape=(), dtype=resource, numpy=<unprintable>>,
<tf.Tensor: shape=(), dtype=resource, numpy=<unprintable>>],