Please use. NET 5,. NET 6, NET 7,. NET 8, NET Framework 4.6, NET Framework 4.61, NET Framework 4.7, NET Framework 4.72, NET Framework 4.8, NET Framework 4.81, and. NET Core 3.1 versions

OnnxRuntimeInferEngineLoadModel 方法

Loads and configures the ONNX model based on the provided configuration 根据提供的配置加载和配置ONNX模型

Definition

命名空间: DeploySharp.Engine
程序集: DeploySharp (在 DeploySharp.dll 中) 版本:0.0.4+6e8a2e904469617cd59619d666c0e272985c0e33
C#
public void LoadModel(
	ref IConfig config
)

参数

config  IConfig
Reference to model configuration containing: - Target device type (CPU, GPU0, GPU1, AUTO, NPU) - ONNX Runtime execution provider type - Model path - Input/output specifications 引用模型配置,包含: - 目标设备类型(CPU、GPU0、GPU1、AUTO、NPU) - ONNX Runtime执行提供程序类型 - 模型路径 - 输入/输出规范

实现

IModelInferEngineLoadModel(IConfig)

备注

Performs three main operations: 1. Configures appropriate execution provider 2. Loads ONNX model session 3. Analyzes model metadata 执行三个主要操作: 1. 配置适当的执行提供程序 2. 加载ONNX模型会话 3. 分析模型元数据

Modifies the configuration object by adding: - Input/output names and shapes - Dynamic input/output detection - Category labels (if available) 修改配置对象,添加: - 输入/输出名称和形状 - 动态输入/输出检测 - 类别标签(如果可用)

异常

ArgumentNullException Thrown when config is null or ModelPath is empty 当config为null或ModelPath为空时抛出
DeploySharpException Thrown for: - Invalid device/execution provider combinations - Unsupported device types - Failed model loading 以下情况抛出: - 无效的设备/执行提供程序组合 - 不支持的设备类型 - 模型加载失败
InvalidOperationException Thrown when model analysis fails 当模型分析失败时抛出

参见