Python Tensorflow输出节点替换为StatefulPartitionedCall,该调用在加载时抛出ValueError
我正在ssd_mobilenet_v2_coco_2018_03_29车型上应用迁移学习。培训结束后,我使用Python Tensorflow输出节点替换为StatefulPartitionedCall,该调用在加载时抛出ValueError,python,tensorflow,keras,Python,Tensorflow,Keras,我正在ssd_mobilenet_v2_coco_2018_03_29车型上应用迁移学习。培训结束后,我使用tf.saved\u model.save(model,saved\u model\u dir)将keras模型保存为saved\u model.pb 原始ssd_mobilenet_v2_coco_2018_03_29型号具有以下特征定义 signature_def['serving_default']: The given SavedModel SignatureDef conta
tf.saved\u model.save(model,saved\u model\u dir)
将keras模型保存为saved\u model.pb
原始ssd_mobilenet_v2_coco_2018_03_29型号具有以下特征定义
signature_def['serving_default']:
The given SavedModel SignatureDef contains the following input(s):
inputs['inputs'] tensor_info:
dtype: DT_UINT8
shape: (-1, -1, -1, 3)
name: image_tensor:0
The given SavedModel SignatureDef contains the following output(s):
outputs['detection_boxes'] tensor_info:
dtype: DT_FLOAT
shape: (-1, 100, 4)
name: detection_boxes:0
outputs['detection_classes'] tensor_info:
dtype: DT_FLOAT
shape: (-1, 100)
name: detection_classes:0
outputs['detection_scores'] tensor_info:
dtype: DT_FLOAT
shape: (-1, 100)
name: detection_scores:0
outputs['num_detections'] tensor_info:
dtype: DT_FLOAT
shape: (-1)
name: num_detections:0
Method name is: tensorflow/serving/predict
保存的模型具有以下特征定义(默认值)
原始模型有4个输出节点detection\u框、detection\u类、detection\u分数、num\u detections
。当我将其导出为保存的模型时,它是如何获得StatefulPartitionedCall
的?我使用tensorboard查看了保存的模型,所有4个输出节点都可见
[tensorboard图像]:[1]:
当我试图使用batchnorm加载(冻结)保存的模型时,我得到以下错误ValueError:节点前缀/StatefulPartitionedCall的输入1是从prefix/Conv1/kernel传递的float:0与预期资源不兼容。
知道发生了什么吗?如何恢复原始输出节点(仍然可见)?我在tf.keras中开发了多输出模型(三个输出),并且面临相同的问题,即所有输出名称都更改为StatefulPartitionedCall:0、StatefulPartitionedCall:1、StatefulPartitionedCall:2
signature_def['__saved_model_init_op']:
The given SavedModel SignatureDef contains the following input(s):
The given SavedModel SignatureDef contains the following output(s):
outputs['__saved_model_init_op'] tensor_info:
dtype: DT_INVALID
shape: unknown_rank
name: NoOp
Method name is:
signature_def['serving_default']:
The given SavedModel SignatureDef contains the following input(s):
inputs['mobilenetv2_1.00_224_input'] tensor_info:
dtype: DT_FLOAT
shape: (-1, 224, 224, 3)
name: serving_default_mobilenetv2_1.00_224_input:0
The given SavedModel SignatureDef contains the following output(s):
outputs['dense'] tensor_info:
dtype: DT_FLOAT
shape: (-1, 5)
name: StatefulPartitionedCall:0
Method name is: tensorflow/serving/predict