简体   繁体   English

使用 MLMultiArray 作为 CoreML 模型的输出

[英]Using an MLMultiArray as an Output of a CoreML model

I trained a YOLOv3-SPP model using PyTorch.我使用 PyTorch 训练了一个 YOLOv3-SPP 模型。 I then saved the model in onnx format and then converted my onnx model to CoreML using onnx-coreml.然后我将模型保存为 onnx 格式,然后使用 onnx-coreml 将我的 onnx 模型转换为 CoreML。 I cannot seem to figure out how to use my model since the outputs are MLMultiArrays.我似乎无法弄清楚如何使用我的模型,因为输出是 MLMultiArrays。

This is what my outputs look like:这是我的输出的样子:

在此处输入图片说明

I am new to Machine Learning and don't know where to begin when it comes to trying to use this model.我是机器学习的新手,在尝试使用此模型时不知道从哪里开始。 I don't know what information each MultiArray contains and cannot figure out how to access it.我不知道每个 MultiArray 包含哪些信息,也无法弄清楚如何访问它。 Given that my model is an object detector trained on 3 classes, can anyone tell me what information each MultiArray holds and how I can get access to it?鉴于我的模型是在 3 个类上训练的对象检测器,谁能告诉我每个 MultiArray 包含哪些信息以及如何访问它? Some sample code with explanation would go a long way.一些带有解释的示例代码会有很长的路要走。 If anybody knows of any Github project that I can simply drop this model into to test it, that would also work.如果有人知道我可以简单地将此模型放入其中进行测试的任何 Github 项目,那也可以。

You need to decode the outputs from the model into bounding boxes etc, just like the PyTorch model does.您需要将模型的输出解码为边界框等,就像 PyTorch 模型一样。 Not everything the PyTorch code does is part of the Core ML model.并非 PyTorch 代码所做的一切都是 Core ML 模型的一部分。

It's too much work to explain this on StackOverflow but I've written extensively about this on my blog: https://machinethink.net/blog/在 StackOverflow 上解释这个工作太多了,但我在我的博客上写了很多关于这个的文章: https : //machinethink.net/blog/

In particular,特别是,

YOLOv3-SPP is different in the details but this should get you started. YOLOv3-SPP 在细节上有所不同,但这应该会让你开始。

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

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