breaking changes to results.object output properties

pull/134/head
Vladimir Mandic 2021-06-01 07:07:01 -04:00
parent 92926aa134
commit 57ad0c886f
12 changed files with 17 additions and 38 deletions

View File

@ -8668,12 +8668,9 @@ async function process2(res, inputSize, outputShape, config3) {
]; ];
const result = { const result = {
id: id++, id: id++,
strideSize,
score: Math.round(100 * score3) / 100, score: Math.round(100 * score3) / 100,
class: j + 1, class: j + 1,
label: labels[j].label, label: labels[j].label,
center: [Math.trunc(outputShape[0] * cx), Math.trunc(outputShape[1] * cy)],
centerRaw: [cx, cy],
box: box6.map((a) => Math.trunc(a)), box: box6.map((a) => Math.trunc(a)),
boxRaw: boxRaw3 boxRaw: boxRaw3
}; };

File diff suppressed because one or more lines are too long

3
dist/human.esm.js vendored
View File

@ -66604,12 +66604,9 @@ async function process2(res, inputSize, outputShape, config3) {
]; ];
const result = { const result = {
id: id++, id: id++,
strideSize,
score: Math.round(100 * score3) / 100, score: Math.round(100 * score3) / 100,
class: j + 1, class: j + 1,
label: labels[j].label, label: labels[j].label,
center: [Math.trunc(outputShape[0] * cx), Math.trunc(outputShape[1] * cy)],
centerRaw: [cx, cy],
box: box6.map((a) => Math.trunc(a)), box: box6.map((a) => Math.trunc(a)),
boxRaw: boxRaw3 boxRaw: boxRaw3
}; };

File diff suppressed because one or more lines are too long

3
dist/human.js vendored
View File

@ -66612,12 +66612,9 @@ return a / b;`;
]; ];
const result = { const result = {
id: id++, id: id++,
strideSize,
score: Math.round(100 * score3) / 100, score: Math.round(100 * score3) / 100,
class: j + 1, class: j + 1,
label: labels[j].label, label: labels[j].label,
center: [Math.trunc(outputShape[0] * cx), Math.trunc(outputShape[1] * cy)],
centerRaw: [cx, cy],
box: box6.map((a) => Math.trunc(a)), box: box6.map((a) => Math.trunc(a)),
boxRaw: boxRaw3 boxRaw: boxRaw3
}; };

View File

@ -8699,12 +8699,9 @@ async function process2(res, inputSize, outputShape, config3) {
]; ];
const result = { const result = {
id: id++, id: id++,
strideSize,
score: Math.round(100 * score3) / 100, score: Math.round(100 * score3) / 100,
class: j + 1, class: j + 1,
label: labels[j].label, label: labels[j].label,
center: [Math.trunc(outputShape[0] * cx), Math.trunc(outputShape[1] * cy)],
centerRaw: [cx, cy],
box: box6.map((a) => Math.trunc(a)), box: box6.map((a) => Math.trunc(a)),
boxRaw: boxRaw3 boxRaw: boxRaw3
}; };

View File

@ -8700,12 +8700,9 @@ async function process2(res, inputSize, outputShape, config3) {
]; ];
const result = { const result = {
id: id++, id: id++,
strideSize,
score: Math.round(100 * score3) / 100, score: Math.round(100 * score3) / 100,
class: j + 1, class: j + 1,
label: labels[j].label, label: labels[j].label,
center: [Math.trunc(outputShape[0] * cx), Math.trunc(outputShape[1] * cy)],
centerRaw: [cx, cy],
box: box6.map((a) => Math.trunc(a)), box: box6.map((a) => Math.trunc(a)),
boxRaw: boxRaw3 boxRaw: boxRaw3
}; };

3
dist/human.node.js vendored
View File

@ -8699,12 +8699,9 @@ async function process2(res, inputSize, outputShape, config3) {
]; ];
const result = { const result = {
id: id++, id: id++,
strideSize,
score: Math.round(100 * score3) / 100, score: Math.round(100 * score3) / 100,
class: j + 1, class: j + 1,
label: labels[j].label, label: labels[j].label,
center: [Math.trunc(outputShape[0] * cx), Math.trunc(outputShape[1] * cy)],
centerRaw: [cx, cy],
box: box6.map((a) => Math.trunc(a)), box: box6.map((a) => Math.trunc(a)),
boxRaw: boxRaw3 boxRaw: boxRaw3
}; };

View File

@ -91,10 +91,10 @@ export function calc(newResult: Result): Result {
bufferedResult.object = JSON.parse(JSON.stringify(newResult.object as Item[])); // deep clone once bufferedResult.object = JSON.parse(JSON.stringify(newResult.object as Item[])); // deep clone once
} else { } else {
for (let i = 0; i < newResult.object.length; i++) { for (let i = 0; i < newResult.object.length; i++) {
const box = newResult.object[i].box // update box const box = (newResult.object[i].box // update box
.map((b, j) => ((bufferedFactor - 1) * bufferedResult.object[i].box[j] + b) / bufferedFactor); .map((b, j) => ((bufferedFactor - 1) * bufferedResult.object[i].box[j] + b) / bufferedFactor)) as [number, number, number, number];
const boxRaw = newResult.object[i].boxRaw // update boxRaw const boxRaw = (newResult.object[i].boxRaw // update boxRaw
.map((b, j) => ((bufferedFactor - 1) * bufferedResult.object[i].boxRaw[j] + b) / bufferedFactor); .map((b, j) => ((bufferedFactor - 1) * bufferedResult.object[i].boxRaw[j] + b) / bufferedFactor)) as [number, number, number, number];
bufferedResult.object[i] = { ...newResult.object[i], box, boxRaw }; // shallow clone plus updated values bufferedResult.object[i] = { ...newResult.object[i], box, boxRaw }; // shallow clone plus updated values
} }
} }

View File

@ -52,13 +52,13 @@ async function process(res, inputSize, outputShape, config) {
detections[0][id][1] / inputSize, detections[0][id][1] / inputSize,
detections[0][id][2] / inputSize, detections[0][id][2] / inputSize,
detections[0][id][3] / inputSize, detections[0][id][3] / inputSize,
]; ] as [number, number, number, number];
const box = [ const box = [
Math.trunc(boxRaw[0] * outputShape[0]), Math.trunc(boxRaw[0] * outputShape[0]),
Math.trunc(boxRaw[1] * outputShape[1]), Math.trunc(boxRaw[1] * outputShape[1]),
Math.trunc(boxRaw[2] * outputShape[0]), Math.trunc(boxRaw[2] * outputShape[0]),
Math.trunc(boxRaw[3] * outputShape[1]), Math.trunc(boxRaw[3] * outputShape[1]),
]; ] as [number, number, number, number];
results.push({ id: i++, score, class: classVal, label, box, boxRaw }); results.push({ id: i++, score, class: classVal, label, box, boxRaw });
} }
return results; return results;

View File

@ -63,14 +63,14 @@ async function process(res, inputSize, outputShape, config) {
]; ];
const result = { const result = {
id: id++, id: id++,
strideSize, // strideSize,
score: Math.round(100 * score) / 100, score: Math.round(100 * score) / 100,
class: j + 1, class: j + 1,
label: labels[j].label, label: labels[j].label,
center: [Math.trunc(outputShape[0] * cx), Math.trunc(outputShape[1] * cy)], // center: [Math.trunc(outputShape[0] * cx), Math.trunc(outputShape[1] * cy)],
centerRaw: [cx, cy], // centerRaw: [cx, cy],
box: box.map((a) => Math.trunc(a)), box: (box.map((a) => Math.trunc(a))) as [number, number, number, number],
boxRaw, boxRaw: boxRaw as [number, number, number, number],
}; };
results.push(result); results.push(result);
} }

View File

@ -116,13 +116,10 @@ export interface Hand {
export interface Item { export interface Item {
id: number, id: number,
score: number, score: number,
strideSize?: number,
class: number, class: number,
label: string, label: string,
center?: number[], box: [number, number, number, number],
centerRaw?: number[], boxRaw: [number, number, number, number],
box: number[],
boxRaw: number[],
} }
/** Gesture results /** Gesture results