报错提示
The Tensor in the split Op's Input Variable X(scale_factor) is not initialized
原因分析
没有根据模型指定给对应的信息
input_names = predictor.get_input_names()
input_handle = predictor.get_input_handle(input_names[0])
print("input_names:",input_names)
input_names: ['image', 'scale_factor']
解决办法
input_info = {}
input_info['image'] = input_img #输入图片的numpy格式
input_info['scale_factor'] = np.array([1., 1.], dtype=np.float32)
for i in range(len(input_names)):
input_tensor = predictor.get_input_handle(input_names[i])
input_tensor.copy_from_cpu(input_info[input_names[i]])