使用重新训练的 Tensorflow 对象检测模型使用 snpe 进行 pb 到 dlc 转换失败

Posted

技术标签:

【中文标题】使用重新训练的 Tensorflow 对象检测模型使用 snpe 进行 pb 到 dlc 转换失败【英文标题】:pb to dlc conversion with snpe fails using a re trained Tensorflow Object Detection model 【发布时间】:2021-09-27 18:44:52 【问题描述】:

Tensorflow 版本:2.5

Snpe 版本:1.51

使用来自Tensorflow Model Zoo 的预训练模型,我重新训练它以仅检测一类对象。根据 TF2 将训练好的模型导出为 saved_model 格式。但是,通过snpe-tensorflow-to-dlc cli 命令运行它会给出模型为空的错误。

命令:

snpe-tensorflow-to-dlc --input_network ./models/mobilenet2/mobi/saved_model --input_dim input_tensor "1,320,320,3" --out_node detection_classes --out_node detection_boxes --out_node detection_scores --out_node num_detections --output_path mobilenet_ssd.dlc  --show_unconsumed_nodes --debug

错误:

Traceback (most recent call last):
  File "/home/mouli/snpe-sdk/snpe-1.51.0.2663/bin/x86_64-linux-clang/snpe-tensorflow-to-dlc", line 71, in <module>
    main()
  File "/home/mouli/snpe-sdk/snpe-1.51.0.2663/bin/x86_64-linux-clang/snpe-tensorflow-to-dlc", line 67, in main
    raise e
  File "/home/mouli/snpe-sdk/snpe-1.51.0.2663/bin/x86_64-linux-clang/snpe-tensorflow-to-dlc", line 56, in main
    optimized_graph = optimizer.optimize(ir_graph)
  File "/home/mouli/snpe-sdk/snpe-1.51.0.2663/lib/python/qti/aisw/converters/common/converter_ir/op_graph_optimizations.py", line 189, in optimize
    remove_disconnected_nodes(graph)
  File "/home/mouli/snpe-sdk/snpe-1.51.0.2663/lib/python/qti/aisw/converters/common/converter_ir/op_graph_optimizations.py", line 406, in remove_disconnected_nodes
    raise ValueError("After pruning disconnected nodes, this model is empty.")
ValueError: After pruning disconnected nodes, this model is empty.

警告:

2021-07-20 13:00:46,640 - 188 - INFO - INFO_TF_CHANGE_NODE_NAME: Change node name: Identity with name detection_anchor_indices
2021-07-20 13:00:46,649 - 188 - INFO - INFO_TF_CHANGE_NODE_NAME: Change node name: Identity_1 with name detection_boxes
2021-07-20 13:00:46,659 - 188 - INFO - INFO_TF_CHANGE_NODE_NAME: Change node name: Identity_2 with name detection_classes
2021-07-20 13:00:46,669 - 188 - INFO - INFO_TF_CHANGE_NODE_NAME: Change node name: Identity_3 with name detection_multiclass_scores
2021-07-20 13:00:46,679 - 188 - INFO - INFO_TF_CHANGE_NODE_NAME: Change node name: Identity_4 with name detection_scores
2021-07-20 13:00:46,689 - 188 - INFO - INFO_TF_CHANGE_NODE_NAME: Change node name: Identity_5 with name num_detections
2021-07-20 13:00:46,701 - 188 - INFO - INFO_TF_CHANGE_NODE_NAME: Change node name: Identity_6 with name raw_detection_boxes
2021-07-20 13:00:46,714 - 188 - INFO - INFO_TF_CHANGE_NODE_NAME: Change node name: Identity_7 with name raw_detection_scores
2021-07-20 13:00:50,213 - 405 - WARNING - ERROR_TF_FALLBACK_TO_ONDEMAND_EVALUATION: Unable to resolve operation output shapes in single pass. Using on-demand evaluation!

2021-07-20 13:00:50,217 - 157 - DEBUG_1 - Added buffer named input_tensor:0 of shape [1, 320, 320, 3]
2021-07-20 13:01:31,590 - 193 - WARNING - WARNING_TF_OP_NOT_SUPPORTED: Operation (StatefulPartitionedCall/map/TensorArrayV2_2) of type (TensorListReserve) is not supported by converter.
2021-07-20 13:01:31,590 - 193 - WARNING - WARNING_TF_OP_NOT_SUPPORTED: Operation (StatefulPartitionedCall/map/StopGradient_1) of type (StopGradient) is not supported by converter.
2021-07-20 13:01:31,590 - 193 - WARNING - WARNING_TF_OP_NOT_SUPPORTED: Operation (StatefulPartitionedCall/map/TensorArrayV2Stack/TensorListStack) of type (TensorListStack) is not supported by converter.
2021-07-20 13:01:31,591 - 193 - WARNING - WARNING_TF_OP_NOT_SUPPORTED: Operation (StatefulPartitionedCall/map/while) of type (StatelessWhile) is not supported by converter.
2021-07-20 13:01:31,591 - 193 - WARNING - WARNING_TF_OP_NOT_SUPPORTED: Operation (StatefulPartitionedCall/map/StopGradient_2) of type (StopGradient) is not supported by converter.
2021-07-20 13:01:31,591 - 193 - WARNING - WARNING_TF_OP_NOT_SUPPORTED: Operation (StatefulPartitionedCall/map/TensorArrayV2Stack_1/TensorListStack) of type (TensorListStack) is not supported by converter.
2021-07-20 13:01:31,591 - 193 - WARNING - WARNING_TF_OP_NOT_SUPPORTED: Operation (StatefulPartitionedCall/map/TensorArrayV2_1) of type (TensorListReserve) is not supported by converter.
2021-07-20 13:01:31,591 - 193 - WARNING - WARNING_TF_OP_NOT_SUPPORTED: Operation (StatefulPartitionedCall/map/TensorArrayUnstack/TensorListFromTensor) of type (TensorListFromTensor) is not supported by converter.
2021-07-20 13:01:31,595 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/Postprocessor/truediv_1) of type (ElementWiseDiv) is not consumed by converter.
2021-07-20 13:01:31,595 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_6_expand_relu/Relu6) of type (Relu6) is not consumed by converter.
2021-07-20 13:01:31,595 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/BoxPredictor/ConvolutionalClassHead_4/Reshape) of type (Reshape) is not consumed by converter.
2021-07-20 13:01:31,595 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_16_depthwise/depthwise) of type (Convolution) is not consumed by converter.
2021-07-20 13:01:31,595 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/FeatureMaps/layer_19_2_Conv2d_5_3x3_s2_128_conv/Conv2D) of type (Convolution) is not consumed by converter.
2021-07-20 13:01:31,595 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/FeatureMaps/layer_19_2_Conv2d_5_3x3_s2_128_batchnorm/FusedBatchNormV3) of type (BatchNormalization) is not consumed by converter.
2021-07-20 13:01:31,596 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_10_depthwise_BN/FusedBatchNormV3) of type (BatchNormalization) is not consumed by converter.
2021-07-20 13:01:31,596 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_4_depthwise_relu/Relu6) of type (Relu6) is not consumed by converter.
2021-07-20 13:01:31,596 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_13_project_BN/FusedBatchNormV3) of type (BatchNormalization) is not consumed by converter.
2021-07-20 13:01:31,596 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_7_depthwise_BN/FusedBatchNormV3) of type (BatchNormalization) is not consumed by converter.
2021-07-20 13:01:31,596 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_4_depthwise_BN/FusedBatchNormV3) of type (BatchNormalization) is not consumed by converter.
2021-07-20 13:01:31,596 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/Postprocessor/convert_scores) of type (Sigmoid) is not consumed by converter.
2021-07-20 13:01:31,596 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_6_expand/Conv2D) of type (Convolution) is not consumed by converter.
2021-07-20 13:01:31,596 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/FeatureMaps/layer_19_1_Conv2d_3_1x1_128_conv/Conv2D) of type (Convolution) is not consumed by converter.
2021-07-20 13:01:31,596 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_5_depthwise/depthwise) of type (Convolution) is not consumed by converter.
2021-07-20 13:01:31,596 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_1_expand_relu/Relu6) of type (Relu6) is not consumed by converter.
2021-07-20 13:01:31,596 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_8_project/Conv2D) of type (Convolution) is not consumed by converter.
2021-07-20 13:01:31,596 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/Squeeze) of type (Reshape) is not consumed by converter.
2021-07-20 13:01:31,596 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_14_add/add) of type (ElementWiseSum) is not consumed by converter.
2021-07-20 13:01:31,596 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_7_depthwise/depthwise) of type (Convolution) is not consumed by converter.
2021-07-20 13:01:31,596 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/Postprocessor/scale_logits) of type (ElementWiseMul) is not consumed by converter.
2021-07-20 13:01:31,596 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_5_depthwise_relu/Relu6) of type (Relu6) is not consumed by converter.
2021-07-20 13:01:31,596 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_10_expand_relu/Relu6) of type (Relu6) is not consumed by converter.
2021-07-20 13:01:31,597 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_12_project/Conv2D) of type (Convolution) is not consumed by converter.
2021-07-20 13:01:31,597 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_14_project_BN/FusedBatchNormV3) of type (BatchNormalization) is not consumed by converter.
2021-07-20 13:01:31,597 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_15_project_BN/FusedBatchNormV3) of type (BatchNormalization) is not consumed by converter.
2021-07-20 13:01:31,597 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/BoxPredictor/ConvolutionalBoxHead_5/BoxEncodingPredictor/Conv2D) of type (Convolution) is not consumed by converter.
2021-07-20 13:01:31,597 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/BoxPredictor/ConvolutionalBoxHead_2/Reshape) of type (Reshape) is not consumed by converter.
2021-07-20 13:01:31,597 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_12_add/add) of type (ElementWiseSum) is not consumed by converter.
2021-07-20 13:01:31,597 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/FeatureMaps/layer_19_1_Conv2d_3_1x1_128_batchnorm/FusedBatchNormV3) of type (BatchNormalization) is not consumed by converter.
2021-07-20 13:01:31,597 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_9_expand_relu/Relu6) of type (Relu6) is not consumed by converter.
2021-07-20 13:01:31,597 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_15_depthwise_BN/FusedBatchNormV3) of type (BatchNormalization) is not consumed by converter.
2021-07-20 13:01:31,597 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_9_expand/Conv2D) of type (Convolution) is not consumed by converter.
2021-07-20 13:01:31,597 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_14_expand_BN/FusedBatchNormV3) of type (BatchNormalization) is not consumed by converter.
2021-07-20 13:01:31,597 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_15_expand_relu/Relu6) of type (Relu6) is not consumed by converter.
2021-07-20 13:01:31,597 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_16_depthwise_BN/FusedBatchNormV3) of type (BatchNormalization) is not consumed by converter.
2021-07-20 13:01:31,597 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/FeatureMaps/layer_19_1_Conv2d_3_1x1_128/Relu6) of type (Relu6) is not consumed by converter.
2021-07-20 13:01:31,597 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_14_depthwise_BN/FusedBatchNormV3) of type (BatchNormalization) is not consumed by converter.
2021-07-20 13:01:31,597 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_5_expand_BN/FusedBatchNormV3) of type (BatchNormalization) is not consumed by converter.
2021-07-20 13:01:31,597 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/FeatureMaps/layer_19_2_Conv2d_3_3x3_s2_256_batchnorm/FusedBatchNormV3) of type (BatchNormalization) is not consumed by converter.
2021-07-20 13:01:31,597 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_5_project_BN/FusedBatchNormV3) of type (BatchNormalization) is not consumed by converter.
2021-07-20 13:01:31,597 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_2_expand_BN/FusedBatchNormV3) of type (BatchNormalization) is not consumed by converter.
2021-07-20 13:01:31,597 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/BoxPredictor/ConvolutionalBoxHead_4/BoxEncodingPredictor/Conv2D) of type (Convolution) is not consumed by converter.
2021-07-20 13:01:31,598 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_1_depthwise_BN/FusedBatchNormV3) of type (BatchNormalization) is not consumed by converter.
2021-07-20 13:01:31,598 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/FeatureMaps/layer_19_1_Conv2d_4_1x1_128_batchnorm/FusedBatchNormV3) of type (BatchNormalization) is not consumed by converter.
2021-07-20 13:01:31,598 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/BoxPredictor/ConvolutionalBoxHead_3/BoxEncodingPredictor/Conv2D) of type (Convolution) is not consumed by converter.
2021-07-20 13:01:31,598 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_2_expand/Conv2D) of type (Convolution) is not consumed by converter.
2021-07-20 13:01:31,598 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_16_expand_relu/Relu6) of type (Relu6) is not consumed by converter.
2021-07-20 13:01:31,598 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_12_project_BN/FusedBatchNormV3) of type (BatchNormalization) is not consumed by converter.
2021-07-20 13:01:31,598 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_6_expand_BN/FusedBatchNormV3) of type (BatchNormalization) is not consumed by converter.
2021-07-20 13:01:31,598 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/FeatureMaps/layer_19_2_Conv2d_4_3x3_s2_256/Relu6) of type (Relu6) is not consumed by converter.
2021-07-20 13:01:31,598 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/FeatureMaps/layer_19_2_Conv2d_5_3x3_s2_128/Relu6) of type (Relu6) is not consumed by converter.
2021-07-20 13:01:31,598 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/BoxPredictor/ConvolutionalClassHead_2/Reshape) of type (Reshape) is not consumed by converter.
2021-07-20 13:01:31,598 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_13_expand/Conv2D) of type (Convolution) is not consumed by converter.
2021-07-20 13:01:31,598 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_10_project_BN/FusedBatchNormV3) of type (BatchNormalization) is not consumed by converter.
2021-07-20 13:01:31,598 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/BoxPredictor/ConvolutionalClassHead_0/ClassPredictor/Conv2D) of type (Convolution) is not consumed by converter.
2021-07-20 13:01:31,598 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/FeatureMaps/layer_19_1_Conv2d_2_1x1_256/Relu6) of type (Relu6) is not consumed by converter.
2021-07-20 13:01:31,598 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_9_depthwise_BN/FusedBatchNormV3) of type (BatchNormalization) is not consumed by converter.
2021-07-20 13:01:31,598 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_9_depthwise/depthwise) of type (Convolution) is not consumed by converter.
2021-07-20 13:01:31,598 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_11_depthwise/depthwise) of type (Convolution) is not consumed by converter.
2021-07-20 13:01:31,598 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_3_depthwise/depthwise) of type (Convolution) is not consumed by converter.
2021-07-20 13:01:31,598 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/Postprocessor/Reshape_2) of type (Reshape) is not consumed by converter.
2021-07-20 13:01:31,599 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/Postprocessor/Decode/transpose_1) of type (SSDDecoderLayer) is not consumed by converter.
2021-07-20 13:01:31,599 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_2_add/add) of type (ElementWiseSum) is not consumed by converter.
2021-07-20 13:01:31,599 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/FeatureMaps/layer_19_2_Conv2d_2_3x3_s2_512/Relu6) of type (Relu6) is not consumed by converter.
2021-07-20 13:01:31,599 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_14_expand_relu/Relu6) of type (Relu6) is not consumed by converter.
2021-07-20 13:01:31,599 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/expanded_conv_depthwise_relu/Relu6) of type (Relu6) is not consumed by converter.
2021-07-20 13:01:31,599 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_8_depthwise/depthwise) of type (Convolution) is not consumed by converter.
2021-07-20 13:01:31,599 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_7_expand_relu/Relu6) of type (Relu6) is not consumed by converter.
2021-07-20 13:01:31,599 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_11_project/Conv2D) of type (Convolution) is not consumed by converter.
2021-07-20 13:01:31,599 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_4_project_BN/FusedBatchNormV3) of type (BatchNormalization) is not consumed by converter.
2021-07-20 13:01:31,599 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_11_add/add) of type (ElementWiseSum) is not consumed by converter.
2021-07-20 13:01:31,599 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/FeatureMaps/layer_19_2_Conv2d_3_3x3_s2_256/Relu6) of type (Relu6) is not consumed by converter.
2021-07-20 13:01:31,599 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_11_project_BN/FusedBatchNormV3) of type (BatchNormalization) is not consumed by converter.
2021-07-20 13:01:31,599 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_1_project_BN/FusedBatchNormV3) of type (BatchNormalization) is not consumed by converter.
2021-07-20 13:01:31,599 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/FeatureMaps/layer_19_1_Conv2d_5_1x1_64_conv/Conv2D) of type (Convolution) is not consumed by converter.
2021-07-20 13:01:31,599 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_14_project/Conv2D) of type (Convolution) is not consumed by converter.
2021-07-20 13:01:31,599 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_14_expand/Conv2D) of type (Convolution) is not consumed by converter.
2021-07-20 13:01:31,599 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_5_expand_relu/Relu6) of type (Relu6) is not consumed by converter.
2021-07-20 13:01:31,599 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/Conv1_relu/Relu6) of type (Relu6) is not consumed by converter.
2021-07-20 13:01:31,599 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/bn_Conv1/FusedBatchNormV3) of type (BatchNormalization) is not consumed by converter.
2021-07-20 13:01:31,600 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_8_expand_relu/Relu6) of type (Relu6) is not consumed by converter.
2021-07-20 13:01:31,600 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_9_project/Conv2D) of type (Convolution) is not consumed by converter.
2021-07-20 13:01:31,600 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/Conv_1_bn/FusedBatchNormV3) of type (BatchNormalization) is not consumed by converter.
2021-07-20 13:01:31,600 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_15_add/add) of type (ElementWiseSum) is not consumed by converter.
2021-07-20 13:01:31,600 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/Postprocessor/stack_1) of type (Pack) is not consumed by converter.
2021-07-20 13:01:31,600 - 193 - WARNING - WARNING_TF_LAYER_NOT_CONSUMED: Layer (StatefulPartitionedCall/ssd_mobile_net_v2keras_feature_extractor/model/block_10_depthwise/depthwise) of type (Convolution) is not consumed by converter.

 .
 .
 .
 .
 .
 .
 .
 .
2021-07-20 13:01:31,615 - 164 - DEBUG_2 - Applying graph Optimizations...
2021-07-20 13:01:31,616 - 164 - DEBUG_2 - Evaluating to match Sequence ['constant', 'elementwise_product', 'constant', 'elementwise_sum']...
2021-07-20 13:01:31,616 - 164 - DEBUG_2 - Found 0 match(es)
2021-07-20 13:01:31,616 - 164 - DEBUG_2 - Evaluating to match Sequence ['pad']...
2021-07-20 13:01:31,617 - 164 - DEBUG_2 - Found 0 match(es)
2021-07-20 13:01:31,617 - 164 - DEBUG_2 - Evaluating to match Sequence ['concatenation']...
2021-07-20 13:01:31,617 - 164 - DEBUG_2 - Found 0 match(es)
2021-07-20 13:01:31,617 - 164 - DEBUG_2 - Evaluating to match Sequence ['concatenation']...
2021-07-20 13:01:31,618 - 164 - DEBUG_2 - Found 0 match(es)
2021-07-20 13:01:31,618 - 164 - DEBUG_2 - Evaluating to match Sequence ['reshape', 'permute', 'reshape']...
2021-07-20 13:01:31,618 - 164 - DEBUG_2 - Found 0 match(es)
2021-07-20 13:01:31,618 - 164 - DEBUG_2 - Evaluating to match Sequence ['elementwise_sum', 'neuron', 'elementwise_product', 'elementwise_product']...
2021-07-20 13:01:31,619 - 164 - DEBUG_2 - Found 0 match(es)
2021-07-20 13:01:31,619 - 164 - DEBUG_2 - Evaluating to match Sequence ['elementwise_sum', 'neuron', 'elementwise_product', 'elementwise_product']...
2021-07-20 13:01:31,619 - 164 - DEBUG_2 - Found 0 match(es)
2021-07-20 13:01:31,619 - 164 - DEBUG_2 - Evaluating to match Sequence ['elementwise_sum', 'neuron', 'elementwise_product', 'elementwise_div']...
2021-07-20 13:01:31,619 - 164 - DEBUG_2 - Found 0 match(es)
2021-07-20 13:01:31,619 - 164 - DEBUG_2 - Evaluating to match Sequence ['elementwise_sum', 'neuron', 'elementwise_div', 'elementwise_product']...
2021-07-20 13:01:31,620 - 164 - DEBUG_2 - Found 0 match(es)
2021-07-20 13:01:31,620 - 164 - DEBUG_2 - Evaluating to match Sequence ['reshape', 'permute', 'reshape', 'permute', 'reshape', 'permute', 'reshape']...
2021-07-20 13:01:31,620 - 164 - DEBUG_2 - Found 0 match(es)
2021-07-20 13:01:31,620 - 164 - DEBUG_2 - Evaluating to match Sequence ['scale']...
2021-07-20 13:01:31,621 - 164 - DEBUG_2 - Found 0 match(es)
2021-07-20 13:01:31,621 - 164 - DEBUG_2 - Evaluating to match Sequence ['elementwise_product']...
2021-07-20 13:01:31,621 - 164 - DEBUG_2 - Found 0 match(es)
2021-07-20 13:01:31,621 - 164 - DEBUG_2 - Evaluating to match Sequence ['elementwise_div']...
2021-07-20 13:01:31,622 - 164 - DEBUG_2 - Found 0 match(es)
2021-07-20 13:01:31,622 - 164 - DEBUG_2 - Evaluating to match Sequence ['elementwise_sum']...
2021-07-20 13:01:31,622 - 164 - DEBUG_2 - Found 0 match(es)
2021-07-20 13:01:31,622 - 164 - DEBUG_2 - Evaluating to match Sequence ['elementwise_sub']...
2021-07-20 13:01:31,622 - 164 - DEBUG_2 - Found 0 match(es)
2021-07-20 13:01:31,623 - 164 - DEBUG_2 - Evaluating to match Sequence ['convolution']...
2021-07-20 13:01:31,623 - 164 - DEBUG_2 - Found 0 match(es)
2021-07-20 13:01:31,623 - 164 - DEBUG_2 - Evaluating to match Sequence ['fully_connected']...
2021-07-20 13:01:31,623 - 164 - DEBUG_2 - Found 0 match(es)
2021-07-20 13:01:31,623 - 164 - DEBUG_2 - Evaluating to match Sequence ['non_max_suppression']...
2021-07-20 13:01:31,624 - 164 - DEBUG_2 - Found 0 match(es)
2021-07-20 13:01:31,624 - 164 - DEBUG_2 - Evaluating to match Sequence ['elementwise_sum']...
2021-07-20 13:01:31,624 - 164 - DEBUG_2 - Found 0 match(es)
2021-07-20 13:01:31,624 - 193 - WARNING - Output node detection_classes, specified via command line, does not exist in graph.
2021-07-20 13:01:31,624 - 193 - WARNING - Output node detection_boxes, specified via command line, does not exist in graph.
2021-07-20 13:01:31,624 - 193 - WARNING - Output node detection_scores, specified via command line, does not exist in graph.
2021-07-20 13:01:31,624 - 193 - WARNING - Output node num_detections, specified via command line, does not exist in graph.

2021-07-20 13:01:31,624 - 183 - ERROR - Conversion FAILED!

注意:在预训练模型上运行相同的命令直接导致模型转换成功。

我假设错误是由于重新训练模型时类数的变化造成的。可以做些什么来解决这个错误?关于这方面的信息很少,Qualcomm 开发者论坛似乎完全不活跃。

【问题讨论】:

【参考方案1】:

更新:发现问题出在对象检测API的内部脚本中,可以使用exporter_main_v2.pyexporter_lib_v2.py的旧提交版本解决

对于遇到相同问题的任何人,请参阅此 Github 线程, https://github.com/tensorflow/models/issues/10120

特别是这条评论https://github.com/tensorflow/models/issues/10120#issuecomment-881984975

【讨论】:

以上是关于使用重新训练的 Tensorflow 对象检测模型使用 snpe 进行 pb 到 dlc 转换失败的主要内容,如果未能解决你的问题,请参考以下文章

如何在 Tensorflow 对象检测 api 中评估预训练模型

TensorFlow 对象检测 api:使用预训练模型在训练中更改类数时的分类权重初始化

为啥 TensorFlow 对象检测 2.x 在训练模型时不显示 mAP

使用 MobileNet 重新训练图像检测

小白学习tensorflow教程四使用 tfhub中的模型EfficientDet-Lite2 进行对象检测

小白学习tensorflow教程四使用 tfhub中的模型EfficientDet-Lite2 进行对象检测