我正在尝试使用以下代码转换使用张量流集线器创建的张量流模型 . 用于该模型的基础模型是inceptionv3

import tensorflow as tf
tf_model_path = 'Inception_v3_US_output_graph.pb'
with open(tf_model_path, 'rb') as f:
serialized = f.read()
tf.reset_default_graph()
original_gdef = tf.GraphDef()
original_gdef.ParseFromString(serialized)

with tf.Graph().as_default() as g:
tf.import_graph_def(original_gdef, name='')
ops = g.get_operations()
N = len(ops)
for i in [0,1,2,N-3,N-2,N-1]:
print('\n\nop id {} : op type: "{}"'.format(str(i), ops[i].type));
print('input(s):'),
for x in ops[i].inputs:
print("name = {}, shape: {}, ".format(x.name, x.get_shape())),
print('\noutput(s):'),
for x in ops[i].outputs:
print("name = {}, shape: {},".format(x.name, x.get_shape())),

这产生了以下输出

op id 0:op type:“placeholder”input(s):output(s):name = Placeholder:0,shape:(?,224,224,3),op id 1:op type:“Const”input (s):output(s):name = module / conv0 / weights:0,shape:(3,3,3,32),op id 2:op type:“Const”input(s):output(s) :name = module / conv0_bn / gamma:0,shape:(32,),op id 3236:op type:“MatMul”input(s):name = input / BottleneckInputPlaceholder:0,shape:(?,1056),name = final_retrain_ops / weights / final_weights / read:0,shape:(1056,2),output(s):name = final_retrain_ops / Wx_plus_b / MatMul:0,shape:(?,2),op id 3237:op type:“添加“input(s):name = final_retrain_ops / Wx_plus_b / MatMul:0,shape:(?,2),name = final_retrain_ops / biases / final_biases / read:0,shape:(2,),output(s):name = final_retrain_ops / Wx_plus_b / add:0,shape:(?,2),op id 3238:op type:“Softmax”input(s):name = final_retrain_ops / Wx_plus_b / add:0,shape:(?,2), output(s):name = final_result:0,shape:(?,2),然后我尝试使用以下代码将其转换为coreml模型

import tfcoreml

input_tensor_shapes = {"Placeholder:0":[1,224,224,3]} # batch size is 1

image_input_name = ['Placeholder:0']

coreml_model_file = 'Inception_v3_US_output_graph.pb'

output_tensor_names = ['final_result:0']

class_labels = 'Inception_v3_US_output_labels.txt'

coreml_model = tfcoreml.convert(
tf_model_path=tf_model_path,
mlmodel_path=coreml_model_file,
input_name_shape_dict=input_tensor_shapes,
output_feature_names=output_tensor_names,
image_input_names = image_input_name,
class_labels = class_labels)

但最终得到以下错误 . 以下是错误消息的最后几行

2308/3239:转换操作名称:占位符(类型:占位符)跳过占位符的名称2309/3239:转换操作名称:module_apply_default / hub_input / Mul(类型:Mul)2310/3239:转换操作名称:module_apply_default / hub_input / Sub (类型:子)2311/3239:转换操作名称:module_apply_default / conv0 / Conv2D(类型:Conv2D)2312/3239:转换操作名称:module_apply_default / conv0_bn / FusedBatchNorm(类型:FusedBatchNorm)2313/3239:转换操作名称:module_apply_default / cell_stem_1 / Relu(类型:Relu)2314/3239:转换操作名称:module_apply_default / cell_stem_1 / Pad(类型:填充)2315/3239:转换操作名称:module_apply_default / cell_stem_1 / strided_slice(类型:StridedSlice)AssertionError Traceback(最新版本)在最后调用()18 output_feature_names = output_tensor_names,19 image_input_names = image_input_name,---> 20 class_labels = class_labels)〜/ tfcoreml / tf-coreml / tfcoreml / _tf_coreml_converter.py in convert(tf_model_path,mlmodel_path,output_feature_names, input_name_shape_dict,image_input_names,is_bgr,red_bias,green_bias,blue_bias,gray_bias,image_scale,class_labels,predict_feature_name,predict_probabilities_output)491 class_labels = class_labels,492 predict_feature_name = predict_feature_name, - > 493 predict_probabilities_output = predict_probabilities_output)〜/ tfcoreml / tf-coreml / tfcoreml / _convert_pb_to_mlmodel中的_tf_coreml_converter.py(tf_model_path,mlmodel_path,output_feature_names,input_name_shape_dict,image_input_names,is_bgr,red_bias,green_bias,blue_bias,gray_bias,image_scale,class_labels,predict_feature_name,predict_probabilities_output)289 context.input_feed_dict = input_feed_dict 290 context.skip_ops = skip_ops - > 291 convert_ops_to_layers(context)292 sess.close()293~ / tfcoreml / tf-coreml / tfcoreml / _ops_to_layers.py in convert_ops_to_layers(context)146 print('%d /%d:转换操作名称:%s(类型:%s) )'%(147 i 1,len(context.all_ops),op.name,op.type)) - > 148翻译(op,context)1 49 strided_slice中的connect_skipped_ops(context)〜/ tfcoreml / tf-coreml / tfcoreml / _layers.py(op,context)1184 skip(op,context)1185 else: - > 1186断言False,'Strided Slice case not handling'1187 context .translated [output_name] = True 1188 AssertionError:未处理Strided Slice案例

如何解决这个问题