简体   繁体   English

如何阅读 CoreML model 预测 MLMultiArray

[英]How to read CoreML model Prediction MLMultiArray

I am new to CoreML and I have generated a coreML model that return the Double 9 × 4 matrix matrix as shown in image blow.我是 CoreML 的新手,我生成了一个 coreML model,它返回 Double 9 × 4 矩阵,如下图所示。

在此处输入图像描述

Here is the code that is working fine and giving me the MLMultiArray.这是工作正常并为我提供 MLMultiArray 的代码。

 let outFeatures = try model.prediction(from: input)
        
        // get all 4 featrue array from image
        
        // MLFeature Value
        //1 × 3 × 20 × 20 × 8
        let confidence = outFeatures.featureValue(for: "confidence")?.multiArrayValue
        let coordinates = outFeatures.featureValue(for: "coordinates")?.multiArrayValue

Now I have to read each row of the MLMultiArray and also the values of column of each row.现在我必须读取 MLMultiArray 的每一行以及每一行的列值。 I have search a lot on inte.net but did not find any looping method that can iterate on MLMultiArray.我在 inte.net 上搜索了很多,但没有找到任何可以在 MLMultiArray 上迭代的循环方法。 Any solution for this.任何解决方案。

Have a look at https://github.com/pytorch/ios-demo-app/tree/master/ObjectDetection this helped me to understand aa bunch of stuff, also search for some yolo coreML看看https://github.com/pytorch/ios-demo-app/tree/master/ObjectDetection这帮助我理解了一堆东西,还搜索了一些 yolo coreML

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM