加载明文模型 - YoloLoadModelEx
函数简介
从磁盘加载明文模型(ONNX / TensorRT Engine / NCNN)。
接口名称
YoloLoadModelEx
DLL 调用
long YoloLoadModelEx(long ola, string modelPath, string ncnnParamPath, string namesLabel, int modelType, int inferenceType, int inferenceDevice);
参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| ola | 长整数型 | OLAPlug 对象指针,由 CreateCOLAPlugInterFace 生成。 |
| modelPath | 字符串 | 主模型路径:ONNX/Engine 单文件;NCNN 为 .bin |
| ncnnParamPath | 字符串 | NCNN 的 .param 路径;非 NCNN 传空字符串 |
| namesLabel | 字符串 | 类别名文件(一行一类),可选空 |
| modelType | 整数型 | 模型后端类型,见下表 |
| inferenceType | 整数型 | 推理任务类型,见下表 |
| inferenceDevice | 整数型 | inferenceDevice:-1 表示 CPU;0 及以上表示 GPU 索引。GPU 不可用时可能自动回退 CPU(以实际 ExecutionProvider 为准)。 |
示例
long h = YoloLoadModelEx(ola, "D:\\yolo11n.onnx", "", "D:\\coco.names", 1, 0, -1);
返回值
长整数型:模型句柄,失败返回 0。
注意事项
- 需要插件已开通 Yolos 模块权限。
| 值 | 含义 |
|---|---|
| 0 | TensorRT Engine(.engine) |
| 1 | ONNX(.onnx) |
| 2 | NCNN(.bin + .param 双文件) |
| 值 | 含义 |
|---|---|
| 0 | Detect 目标检测 |
| 1 | Classify 图像分类 |
| 2 | Segment 实例分割 |
| 3 | Pose 姿态估计 |
| 4 | Obb 旋转框检测 |
inferenceDevice:-1表示 CPU;0及以上表示 GPU 索引。GPU 不可用时可能自动回退 CPU(以实际 ExecutionProvider 为准)。- 勿传入加密包路径。
