mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-06 17:17:14 +08:00
[Other] Refactor js submodule (#415)
* Refactor js submodule * Remove change-log * Update ocr module * Update ocr-detection module * Update ocr-detection module * Remove change-log
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* @file detect model
|
||||
*/
|
||||
|
||||
import { Runner } from '@paddlejs/paddlejs-core';
|
||||
import '@paddlejs/paddlejs-backend-webgl';
|
||||
|
||||
let detectRunner = null as Runner;
|
||||
|
||||
export async function init() {
|
||||
detectRunner = new Runner({
|
||||
modelPath: 'https://paddlejs.bj.bcebos.com/models/fuse/detect/detect_fuse_activation/model.json',
|
||||
fill: '#fff',
|
||||
mean: [0.5, 0.5, 0.5],
|
||||
std: [0.5, 0.5, 0.5],
|
||||
bgr: true,
|
||||
keepRatio: false,
|
||||
webglFeedProcess: true
|
||||
});
|
||||
|
||||
await detectRunner.init();
|
||||
}
|
||||
|
||||
export async function detect(image) {
|
||||
const output = await detectRunner.predict(image);
|
||||
// 阈值
|
||||
const thresh = 0.3;
|
||||
return output.filter(item => item[1] > thresh);
|
||||
}
|
Reference in New Issue
Block a user