如何使用yolo v3模型带有两个输出在ML C#中检测对象?

问题描述

我有tiny yolo v3个预先训练的模型,我想在C#中使用它,以便能够检测对象。 我遇到了以下working sample code,但该教程是针对具有以下属性tiny yolo v2模型制作的:

enter image description here

我的预训练模型具有以下属性

![enter image description here

因此,不仅名称输出数量和输入/输出参数不兼容。由于ML不是我的专长,因此我在迁移代码支持我拥有的这种新模型方面遇到困难。

到目前为止,我所做的是:

来自:

public const int ROW_COUNT = 13;
public const int COL_COUNT = 13;
public const int CHANNEL_COUNT = 125;
public const int BoxES_PER_CELL = 5;
public const int Box_INFO_FEATURE_COUNT = 5;
public const int CLASS_COUNT = 20;
public const float CELL_WIDTH = 32;
public const float CELL_HEIGHT = 32;

进入(根据提供模型的人的评论):

public const int ROW_COUNT = 13;
public const int COL_COUNT = 13;
public const int CHANNEL_COUNT = 18;
public const int BoxES_PER_CELL = 3;
public const int Box_INFO_FEATURE_COUNT = 5;
public const int CLASS_COUNT = 1;
public const float CELL_WIDTH = 32;
public const float CELL_HEIGHT = 32;

我还用训练模型的一个类替换了类名。

在所有更改之后的最终结果中,该应用程序未引发错误,但显示警告,并且未按预期检测到对象。这是我得到的输出

enter image description here

警告说:

...
2020-08-25 14:46:40.5959296 [W:onnxruntime:,graph.cc:863 onnxruntime::Graph::Graph] Initializer 022_convolutional_bn_bias appears in graph inputs and will not be treated as constant value/weight. This may prevent some of the graph optimizations,like const folding. Move it out of graph inputs if there is no need to override it,by either re-generating the model with latest exporter/converter or with the tool onnxruntime/tools/python/remove_initializer_from_input.py.
2020-08-25 14:46:40.5970795 [W:onnxruntime:,graph.cc:863 onnxruntime::Graph::Graph] Initializer 022_convolutional_bn_mean appears in graph inputs and will not be treated as constant value/weight. This may prevent some of the graph optimizations,by either re-generating the model with latest exporter/converter or with the tool onnxruntime/tools/python/remove_initializer_from_input.py.
2020-08-25 14:46:40.5979695 [W:onnxruntime:,graph.cc:863 onnxruntime::Graph::Graph] Initializer 022_convolutional_bn_var appears in graph inputs and will not be treated as constant value/weight. This may prevent some of the graph optimizations,by either re-generating the model with latest exporter/converter or with the tool onnxruntime/tools/python/remove_initializer_from_input.py.
2020-08-25 14:46:40.5988356 [W:onnxruntime:,graph.cc:863 onnxruntime::Graph::Graph] Initializer 022_convolutional_conv_weights appears in graph inputs and will not be treated as constant value/weight. This may prevent some of the graph optimizations,by either re-generating the model with latest exporter/converter or with the tool onnxruntime/tools/python/remove_initializer_from_input.py.
2020-08-25 14:46:40.5996638 [W:onnxruntime:,graph.cc:863 onnxruntime::Graph::Graph] Initializer 023_convolutional_conv_bias appears in graph inputs and will not be treated as constant value/weight. This may prevent some of the graph optimizations,by either re-generating the model with latest exporter/converter or with the tool onnxruntime/tools/python/remove_initializer_from_input.py.
2020-08-25 14:46:40.6006995 [W:onnxruntime:,graph.cc:863 onnxruntime::Graph::Graph] Initializer 023_convolutional_conv_weights appears in graph inputs and will not be treated as constant value/weight. This may prevent some of the graph optimizations,by either re-generating the model with latest exporter/converter or with the tool onnxruntime/tools/python/remove_initializer_from_input.py.

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)