【问题标题】:Use TensorFlow model with Swift for iOS在 Swift for iOS 中使用 TensorFlow 模型
【发布时间】:2020-12-08 16:34:12
【问题描述】:

我们正在尝试在我们的 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)
}

任何帮助将不胜感激!

【问题讨论】:

    标签: swift tensorflow tensorflow2.0 coreml coremltools


    【解决方案1】:

    这些数字的含义完全取决于您使用的型号。它与 TensorFlow 和 Core ML 均无关。

    输出是一个 1x1x1x1404 的张量,这基本上意味着你得到一个 1404 个数字的列表。如何解释这些数字取决于模型的设计目的。

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

    【讨论】:

    猜你喜欢
    • 2019-10-08
    • 1970-01-01
    • 1970-01-01
    • 2019-02-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多