6.7.0 - Alpha16 - 打包应用支持自带离线 Paddle OCR 引擎, 避免依赖插件安装

This commit is contained in:
SuperMonster003
2026-01-18 23:33:18 +08:00
parent 52be56318f
commit a46d78b704
54 changed files with 2745 additions and 253 deletions

View File

@@ -0,0 +1,26 @@
/**
* @author TonyJiangWJ
*/
!function internalApiForPaddleOcr() {
console.show();
// 指定是否用精简版模型, 速度较快, 默认为 true
let useSlim = false;
// CPU 线程数量, 实际好像没啥作用
let cpuThreadNum = 4;
let start = new Date();
let img = images.read('test.png');
let results = ocr.paddle.detect(img, { useSlim, cpuThreadNum });
toastLog(`识别结束, 耗时: ${new Date() - start}ms`);
log(`识别结果: ${JSON.stringify(
Array.from(results).map((result) => {
return { label: result.label, confidence: result.confidence, bounds: result.bounds };
}))}`);
// 回收图片
img.recycle();
}();