[Model] add Paddle.js web demo (#392)

* add application include paddle.js web demo and xcx

* cp PR #5

* add readme

* fix comments and link

* fix xcx readme

* fix Task 1

* fix bugs

* refine readme

* delete ocrxcx readme

* refine readme

* fix bugs

* delete old readme

* 200px to 300px

* revert 200px to 300px

Co-authored-by: Jason <jiangjiajun@baidu.com>
This commit is contained in:
Double_V
2022-10-20 17:01:38 +08:00
committed by GitHub
parent 587ffd4caf
commit 0a22979c35
302 changed files with 63930 additions and 0 deletions

View File

@@ -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);
}