关于python中mediapipe的疑问
出现问题
Feedback manager requires a model with a single signature inference. Disabling support for feedback tensors.
问题来源
.venv/Lib/site-packages/mediapipe/calculators/tensor/inference_feedback_manager.cc
的签名有多个??
完整问题:
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
W0000 00:00:1718077239.527317 22164 inference_feedback_manager.cc:114] Feedback manager requires a model with a single signature inference. Disabling support for feedback tensors.
W0000 00:00:1718077239.549830 22164 inference_feedback_manager.cc:114] Feedback manager requires a model with a single signature inference. Disabling support for feedback tensors.
尝试解决并失败
尝试修改对应的.cc文件报错仍然存在
//修改源码,对多个签名时使用第一个签名
if (input_output_tensor_names_map.empty()) {
ABSL_LOG(WARNING) << "No input output tensor names provided. Unable to create feedback indices.";
return absl::InvalidArgumentError("Input output tensor names map is empty.");
}
for (const auto& io_mapping : input_output_tensor_names_map) {
const std::string& output_tensor_name = io_mapping.second;
const int model_tensor_index = GetModelTensorIndex(io_config, output_tensor_name);
if (model_tensor_index >= 0) {
TensorFeedbackIndicesLink indices_link;
indices_link.output_tensor_name = output_tensor_name;
indices_link.model_tensor_index = model_tensor_index;
indices_links.push_back(indices_link);
} else {
ABSL_LOG(WARNING) << "Cannot find model tensor index for output tensor: " << output_tensor_name;
}
}
// if (input_output_tensor_names_map.empty() ||
// input_output_tensor_names_map.size() > 1) {
// // Fail gracefully by returning an empty TensorFeedbackIndicesLink list if
// // SignatureDef is not available or not supported.
// ABSL_LOG(WARNING)
// << "Feedback manager requires a model with a single signature "
// "inference. Disabling support for feedback tensors.";
// return indices_links;
// }
// Obtain reference to single-signature in input_output_tensor_names_map.
原始的文件内容
if (input_output_tensor_names_map.empty() ||
input_output_tensor_names_map.size() > 1) {
// Fail gracefully by returning an empty TensorFeedbackIndicesLink list if
// SignatureDef is not available or not supported.
ABSL_LOG(WARNING)
<< "Feedback manager requires a model with a single signature "
"inference. Disabling support for feedback tensors.";
return indices_links;
}
Obtain reference to single-signature in input_output_tensor_names_map.
修改后保存未发生报错改变,报错还是一样的