mirror of https://github.com/vladmandic/human
add id and boxraw on missing objects
parent
714d95f6ed
commit
4b221c17ea
|
@ -9,7 +9,8 @@ import webRTC from './helpers/webrtc.js';
|
|||
let human;
|
||||
|
||||
const userConfig = {
|
||||
warmup: 'none',
|
||||
warmup: 'full',
|
||||
/*
|
||||
backend: 'webgl',
|
||||
async: false,
|
||||
cacheSensitivity: 0,
|
||||
|
@ -29,6 +30,7 @@ const userConfig = {
|
|||
body: { enabled: true, modelPath: 'posenet.json' },
|
||||
// body: { enabled: true, modelPath: 'blazepose.json' },
|
||||
object: { enabled: false },
|
||||
*/
|
||||
};
|
||||
|
||||
// ui options
|
||||
|
|
|
@ -538,6 +538,7 @@ export class Human {
|
|||
object: objectRes,
|
||||
performance: this.perf,
|
||||
canvas: process.canvas,
|
||||
timestamp: Date.now(),
|
||||
};
|
||||
// log('Result:', result);
|
||||
resolve(res);
|
||||
|
|
|
@ -32,7 +32,8 @@ export function getBoundingBox(keypoints) {
|
|||
export function scalePoses(poses, [height, width], [inputResolutionHeight, inputResolutionWidth]) {
|
||||
const scaleY = height / inputResolutionHeight;
|
||||
const scaleX = width / inputResolutionWidth;
|
||||
const scalePose = (pose) => ({
|
||||
const scalePose = (pose, i) => ({
|
||||
id: i,
|
||||
score: pose.score,
|
||||
bowRaw: [pose.box[0] / inputResolutionWidth, pose.box[1] / inputResolutionHeight, pose.box[2] / inputResolutionWidth, pose.box[3] / inputResolutionHeight],
|
||||
box: [Math.trunc(pose.box[0] * scaleX), Math.trunc(pose.box[1] * scaleY), Math.trunc(pose.box[2] * scaleX), Math.trunc(pose.box[3] * scaleY)],
|
||||
|
@ -42,7 +43,7 @@ export function scalePoses(poses, [height, width], [inputResolutionHeight, input
|
|||
position: { x: Math.trunc(position.x * scaleX), y: Math.trunc(position.y * scaleY) },
|
||||
})),
|
||||
});
|
||||
const scaledPoses = poses.map((pose) => scalePose(pose));
|
||||
const scaledPoses = poses.map((pose, i) => scalePose(pose, i));
|
||||
return scaledPoses;
|
||||
}
|
||||
|
||||
|
|
|
@ -150,4 +150,5 @@ export interface Result {
|
|||
object: Array<Item>
|
||||
performance: { any },
|
||||
canvas: OffscreenCanvas | HTMLCanvasElement,
|
||||
timestamp: number,
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue