跳到主要內容
支援知識庫

使用 OpenVINO™ 2022.2 時是否可以讀取模型的層?

內容類型: 疑難排解   |   文章 ID: 000092984   |   最近查看日期: 2023 年 11 月 20 日

描述

  1. 使用 OpenVINO™ 2020.3 時,使用 net.layers 和 layers.blob 讀取模型的層。
  2. 使用 2022.2 時無法讀取模型的層OpenVINO™因為 net.layers 和 layers.blob 自 2021.2 OpenVINO™起已被棄用。

解決方法

對於 OpenVINO™ 2022.2,模型圖層的權重位於網路的常量操作中。

使用 get_data() 方法從 OpenVINO™ 2022.2 中的常量節點檢索權重值:
from openvino.inference_engine import IECore
import ngraph as ng

ie = IECore()
path_xml="<model_name>.xml"
path_bin="<model_name>.bin"

net = ie.read_network(model=path_xml, weights=path_bin)

func = ng.function_from_cnn(net)

ops = func.get_ops()
print(ops[14]) #Print the node attributes for the specific node index
print(ops[14].get_data()) #Specific Constant operations layer, all weights are located in the Constant operations

相關產品

本文章適用 3 產品。
Intel® Xeon Phi™ 處理器軟體 OpenVINO™ toolkit 效能程式庫

免責聲明

這個頁面的內容綜合了英文原始內容的人工翻譯譯文與機器翻譯譯文。本內容是基於一般資訊目的,方便您參考而提供,不應視同完整或準確的內容。如果這個頁面的英文版與譯文之間發生任何牴觸,將受英文版規範及管轄。 查看這個頁面的英文版。