在iOS的Swift中使用TensorFlow模型

问题描述

我们正在尝试在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个数字的列表。如何解释这些数字取决于模型的设计目的。

如果您不是自己设计模型,则必须为其找到文档。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...