如何使用Coreml模型输出MLMultiarRay

发布于 2025-01-18 14:08:07 字数 248 浏览 3 评论 0原文

我需要解析 CoreML 模型的预测输出结果。

我可以看到输出的类型是 MLMultiArray,但是当我在代码中使用该类型时,如下所示:

let a = MultiArray(result.transpose_1_tmp_0)

它总是抛出错误:

在范围内找不到“MultiArray”

有人知道吗?

I need to parse the results in the output of prediction from a CoreML model.

I can see that the type of output is MLMultiArray, but when I use the type within my code like this:

let a = MultiArray<Float>(result.transpose_1_tmp_0)

It always throws an error:

Cannot find 'MultiArray' in scope

Anyone has any idea?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

茶色山野 2025-01-25 14:08:08

Multiarray不是内置数据类型。使用变量名:

var result: MLMultiArray //Your populated array
let a = result[[z, y, x] as [NSNumber]].floatValue

您也可能需要查看 a>。请按照 coremlhelpers 安装指令。

编辑:

mlmultiarraycoreml框架的一部分。要使用它,您必须导入这样的框架:

import CoreML

MultiArray is not a built-in datatype. Use the variable name:

var result: MLMultiArray //Your populated array
let a = result[[z, y, x] as [NSNumber]].floatValue

Also you might want to check out Swiftier MultiArray. Follow the CoreMLHelpers install instructions.

EDIT:

MLMultiArray is part of the CoreML framework. To use it, you must import the framework like this:

import CoreML
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文