主题
批量预热OCR模型 - OcrWarmupModels
函数简介
按 JSON 批量热身已加载 OCR 模型。可一次预热多个句柄,也可只预热内置模型。
接口名称
OcrWarmupModelsDLL 调用
long OcrWarmupModels(long ola, string warmupJson);参数说明
| 参数名 | 类型 | 说明 |
|---|---|---|
| ola | 长整数型 | OLAPlug 对象指针,由 CreateCOLAPlugInterFace 生成。 |
| warmupJson | 字符串 | UTF-8 JSON 对象。 |
warmupJson 字段
| 字段 | 类型 | 说明 |
|---|---|---|
| Handles / ModelHandles | int 数组 | 要预热的句柄列表。省略且当前无已加载模型时,默认预热内置 0。 |
| ModelHandle / Handle | int | 单个句柄,可与 Handles 同时出现(会去重)。 |
| Iterations / Runs | int | 每个模型的热身次数。 |
| Async | bool | true 立即返回并后台预热;false(默认)同步等待。 |
示例
json
{"Handles":[0],"Iterations":1,"Async":true}cpp
long instance = CreateCOLAPlugInterFace();
long ptr = OcrWarmupModels(instance, "{\"Handles\":[0],\"Iterations\":1,\"Async\":true}");
// 返回 JSON 指针,须 FreeStringPtr返回值
JSON 字符串指针,须 FreeStringPtr 释放。
成功示例:{"Success":true,"ActiveModel":0,"Models":[{"ModelHandle":0,"Success":true,"Async":true}]}
Async=true 时不附带完整 Info(避免同步加载)。失败时 Success=false,Models 中带逐模型错误。
注意事项
| 项目 | 说明 |
|---|---|
| 与单模型接口 | 单句柄请优先用 OcrWarmupModel。 |
| 创建对象 | 本接口也不在创建欧拉对象时自动调用。 |
