我想在OpenVino框架上使用C ++/Python API来获得网络每一层的重量和偏差张量。我发现此解决方案,但不幸的是,它使用了不再支持的较旧的API(Release 2019 R3.1)。例如,最新的OpenVino中不存在类 cnnnetreader
。有人知道如何在新版本中实现这一目标吗? (2020+)
谢谢!
I'd like to get the tensor of weights and biases for each layer of the network using the C++/Python API on the OpenVINO framework. I found this solution but unfortunately it uses an older API (release 2019 R3.1) that is no longer supported. For example, the class CNNNetReader
does not exist in the latest OpenVINO. Does anyone know how to achieve this in new releases? (2020+)
Thanks!
发布评论
评论(2)
您可以尝试这样的事情吗?首先,您需要读取模型,图表中的节点上的迭代并过滤常数(我在此处制作副本,因为节点以共享指针为单位)。然后,如果您正在寻找每个常数节点,则可以将每个常数节点转换为值的向量。为此,您可以使用模板方法
cast_vector< t>
,并且可以通过检查常数保留的内容来确定要使用哪种类型(使用get_element_type
)。Can you try something like this? First you need to read-in a model, the iterate over the nodes in the graph and filter the Constants (I'm making a copy here because the nodes are held as shared pointers). Then each Constant node can be transformed into a vector of values if you're looking for that. To do that you can use the templated method
cast_vector<T>
and you can figure out which type to use by checking what the Constant holds (usingget_element_type
).使用类和方法
read_model
读取模型。接下来,使用类中的方法 获取每一层的细节。请参阅 openVino python python api /docs.openvino.ai/latest/groupov_cpp_api.html“ rel =” nofollow noreferrer“> OpenVino Runtime C ++ API 有关更多信息。
Use the class
Core
and the methodread_model
to read the model. Next, use the methods in the classModel
to get the detail for each layer.Refer to OpenVINO Python API and OpenVINO Runtime C++ API for more information.