问题描述
我们正在尝试在iOS应用中使用TensorFlow Face Mesh模型。型号详细信息:https://drive.google.com/file/d/1VFC_wIpw4O7xBOiTgUldl79d9LA-LsnA/view。
我按照TS官方教程设置了模型:https://firebase.google.com/docs/ml-kit/ios/use-custom-models,并在教程中使用Python脚本打印了模型Input-Output,并得到了以下信息:
INPUT
[ 1 192 192 3]
<class 'numpy.float32'>
OUTPUT
[ 1 1 1 1404]
<class 'numpy.float32'>
在这一点上,我很迷茫,无法理解这些数字的含义,以及如何使用模型Interpreter
传递输入图像并获得输出面部网格点。到目前为止,这是我的Swift代码:
let coreMLDelegate = CoreMLDelegate()
var interpreter: Interpreter
// Core ML delegate will only be created for devices with Neural Engine
if coreMLDelegate != nil {
interpreter = try Interpreter(modelPath: modelPath,delegates: [coreMLDelegate!])
} else {
interpreter = try Interpreter(modelPath: modelPath)
}
任何帮助将不胜感激!
解决方法
这些数字的含义完全取决于您使用的模型。它与TensorFlow和Core ML都无关。
输出是1x1x1x1404张量,这基本上意味着您会获得1404个数字的列表。如何解释这些数字取决于模型的设计目的。
如果您不是自己设计模型,则必须为其找到文档。