mirror of https://github.com/vladmandic/human
fix centernet box width & height
parent
221afcb710
commit
a68eec18f3
|
@ -9,7 +9,11 @@ Repository: **<git+https://github.com/vladmandic/human.git>**
|
|||
|
||||
## Changelog
|
||||
|
||||
### **HEAD -> main** 2021/06/08 mandic00@live.com
|
||||
### **HEAD -> main** 2021/06/09 mandic00@live.com
|
||||
|
||||
- add body segmentation sample
|
||||
|
||||
### **release: 2.0.1** 2021/06/08 mandic00@live.com
|
||||
|
||||
- release 2.0
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ let userConfig = {
|
|||
hand: { enabled: false },
|
||||
body: { enabled: false },
|
||||
// body: { enabled: true, modelPath: 'posenet.json' },
|
||||
segmentation: { enabled: true },
|
||||
segmentation: { enabled: false },
|
||||
*/
|
||||
};
|
||||
|
||||
|
@ -547,7 +547,7 @@ async function processImage(input, title) {
|
|||
document.getElementById('loader').style.display = 'none';
|
||||
if (ui.detectThread) cancelAnimationFrame(ui.detectThread);
|
||||
if (ui.drawThread) cancelAnimationFrame(ui.drawThread);
|
||||
|
||||
log('processed image:', title);
|
||||
resolve(true);
|
||||
};
|
||||
image.src = input;
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -252,6 +252,7 @@ var config2 = {
|
|||
gl: null,
|
||||
width: 1024,
|
||||
height: 1024,
|
||||
extensions: [],
|
||||
webGLattr: {
|
||||
alpha: false,
|
||||
antialias: false,
|
||||
|
@ -263,9 +264,14 @@ var config2 = {
|
|||
desynchronized: true
|
||||
}
|
||||
};
|
||||
function extensions() {
|
||||
const gl = config2.gl;
|
||||
if (!gl)
|
||||
return;
|
||||
config2.extensions = gl.getSupportedExtensions();
|
||||
}
|
||||
function register() {
|
||||
if (!tf.findBackend(config2.name)) {
|
||||
log("backend registration:", config2.name);
|
||||
try {
|
||||
config2.canvas = typeof OffscreenCanvas !== "undefined" ? new OffscreenCanvas(config2.width, config2.height) : document.createElement("canvas");
|
||||
} catch (err) {
|
||||
|
@ -307,6 +313,7 @@ function register() {
|
|||
log("error: cannot set WebGL backend flags:", err);
|
||||
return;
|
||||
}
|
||||
extensions();
|
||||
log("backend registered:", config2.name);
|
||||
}
|
||||
}
|
||||
|
@ -8766,11 +8773,15 @@ async function process3(res, inputSize, outputShape, config3) {
|
|||
const score3 = Math.trunc(100 * detections[0][id][4]) / 100;
|
||||
const classVal = detections[0][id][5];
|
||||
const label = labels[classVal].label;
|
||||
const boxRaw3 = [
|
||||
const [x, y] = [
|
||||
detections[0][id][0] / inputSize,
|
||||
detections[0][id][1] / inputSize,
|
||||
detections[0][id][2] / inputSize,
|
||||
detections[0][id][3] / inputSize
|
||||
detections[0][id][1] / inputSize
|
||||
];
|
||||
const boxRaw3 = [
|
||||
x,
|
||||
y,
|
||||
detections[0][id][2] / inputSize - x,
|
||||
detections[0][id][3] / inputSize - y
|
||||
];
|
||||
const box6 = [
|
||||
Math.trunc(boxRaw3[0] * outputShape[0]),
|
||||
|
|
|
@ -253,6 +253,7 @@ var config2 = {
|
|||
gl: null,
|
||||
width: 1024,
|
||||
height: 1024,
|
||||
extensions: [],
|
||||
webGLattr: {
|
||||
alpha: false,
|
||||
antialias: false,
|
||||
|
@ -264,9 +265,14 @@ var config2 = {
|
|||
desynchronized: true
|
||||
}
|
||||
};
|
||||
function extensions() {
|
||||
const gl = config2.gl;
|
||||
if (!gl)
|
||||
return;
|
||||
config2.extensions = gl.getSupportedExtensions();
|
||||
}
|
||||
function register() {
|
||||
if (!tf.findBackend(config2.name)) {
|
||||
log("backend registration:", config2.name);
|
||||
try {
|
||||
config2.canvas = typeof OffscreenCanvas !== "undefined" ? new OffscreenCanvas(config2.width, config2.height) : document.createElement("canvas");
|
||||
} catch (err) {
|
||||
|
@ -308,6 +314,7 @@ function register() {
|
|||
log("error: cannot set WebGL backend flags:", err);
|
||||
return;
|
||||
}
|
||||
extensions();
|
||||
log("backend registered:", config2.name);
|
||||
}
|
||||
}
|
||||
|
@ -8767,11 +8774,15 @@ async function process3(res, inputSize, outputShape, config3) {
|
|||
const score3 = Math.trunc(100 * detections[0][id][4]) / 100;
|
||||
const classVal = detections[0][id][5];
|
||||
const label = labels[classVal].label;
|
||||
const boxRaw3 = [
|
||||
const [x, y] = [
|
||||
detections[0][id][0] / inputSize,
|
||||
detections[0][id][1] / inputSize,
|
||||
detections[0][id][2] / inputSize,
|
||||
detections[0][id][3] / inputSize
|
||||
detections[0][id][1] / inputSize
|
||||
];
|
||||
const boxRaw3 = [
|
||||
x,
|
||||
y,
|
||||
detections[0][id][2] / inputSize - x,
|
||||
detections[0][id][3] / inputSize - y
|
||||
];
|
||||
const box6 = [
|
||||
Math.trunc(boxRaw3[0] * outputShape[0]),
|
||||
|
|
|
@ -252,6 +252,7 @@ var config2 = {
|
|||
gl: null,
|
||||
width: 1024,
|
||||
height: 1024,
|
||||
extensions: [],
|
||||
webGLattr: {
|
||||
alpha: false,
|
||||
antialias: false,
|
||||
|
@ -263,9 +264,14 @@ var config2 = {
|
|||
desynchronized: true
|
||||
}
|
||||
};
|
||||
function extensions() {
|
||||
const gl = config2.gl;
|
||||
if (!gl)
|
||||
return;
|
||||
config2.extensions = gl.getSupportedExtensions();
|
||||
}
|
||||
function register() {
|
||||
if (!tf.findBackend(config2.name)) {
|
||||
log("backend registration:", config2.name);
|
||||
try {
|
||||
config2.canvas = typeof OffscreenCanvas !== "undefined" ? new OffscreenCanvas(config2.width, config2.height) : document.createElement("canvas");
|
||||
} catch (err) {
|
||||
|
@ -307,6 +313,7 @@ function register() {
|
|||
log("error: cannot set WebGL backend flags:", err);
|
||||
return;
|
||||
}
|
||||
extensions();
|
||||
log("backend registered:", config2.name);
|
||||
}
|
||||
}
|
||||
|
@ -8766,11 +8773,15 @@ async function process3(res, inputSize, outputShape, config3) {
|
|||
const score3 = Math.trunc(100 * detections[0][id][4]) / 100;
|
||||
const classVal = detections[0][id][5];
|
||||
const label = labels[classVal].label;
|
||||
const boxRaw3 = [
|
||||
const [x, y] = [
|
||||
detections[0][id][0] / inputSize,
|
||||
detections[0][id][1] / inputSize,
|
||||
detections[0][id][2] / inputSize,
|
||||
detections[0][id][3] / inputSize
|
||||
detections[0][id][1] / inputSize
|
||||
];
|
||||
const boxRaw3 = [
|
||||
x,
|
||||
y,
|
||||
detections[0][id][2] / inputSize - x,
|
||||
detections[0][id][3] / inputSize - y
|
||||
];
|
||||
const box6 = [
|
||||
Math.trunc(boxRaw3[0] * outputShape[0]),
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
"canvas": "^2.8.0",
|
||||
"chokidar": "^3.5.1",
|
||||
"dayjs": "^1.10.5",
|
||||
"esbuild": "^0.12.7",
|
||||
"esbuild": "^0.12.8",
|
||||
"eslint": "^7.28.0",
|
||||
"eslint-config-airbnb-base": "^14.2.1",
|
||||
"eslint-plugin-import": "^2.23.4",
|
||||
|
@ -82,7 +82,7 @@
|
|||
"node-fetch": "^2.6.1",
|
||||
"rimraf": "^3.0.2",
|
||||
"seedrandom": "^3.0.5",
|
||||
"simple-git": "^2.39.0",
|
||||
"simple-git": "^2.39.1",
|
||||
"tslib": "^2.2.0",
|
||||
"typedoc": "^0.21.0-beta.2",
|
||||
"typescript": "4.3.2"
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
2021-06-08 07:28:01 [36mINFO: [39m @vladmandic/human version 2.0.1
|
||||
2021-06-08 07:28:01 [36mINFO: [39m User: vlado Platform: linux Arch: x64 Node: v16.0.0
|
||||
2021-06-08 07:28:01 [36mINFO: [39m Toolchain: tfjs: 3.7.0 esbuild 0.12.7; typescript 4.3.2; typedoc: 0.21.0-beta.2 eslint: 7.28.0
|
||||
2021-06-08 07:28:01 [36mINFO: [39m Clean: ["dist/*","types/*","typedoc/*"]
|
||||
2021-06-08 07:28:01 [36mINFO: [39m Build: file startup all type: production config: {"minifyWhitespace":true,"minifyIdentifiers":true,"minifySyntax":true}
|
||||
2021-06-08 07:28:01 [35mSTATE:[39m target: node type: tfjs: {"imports":1,"importBytes":102,"outputBytes":1303,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-06-08 07:28:01 [35mSTATE:[39m target: node type: node: {"imports":41,"importBytes":430477,"outputBytes":376424,"outputFiles":"dist/human.node.js"}
|
||||
2021-06-08 07:28:01 [35mSTATE:[39m target: nodeGPU type: tfjs: {"imports":1,"importBytes":110,"outputBytes":1311,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-06-08 07:28:01 [35mSTATE:[39m target: nodeGPU type: node: {"imports":41,"importBytes":430485,"outputBytes":376428,"outputFiles":"dist/human.node-gpu.js"}
|
||||
2021-06-08 07:28:01 [35mSTATE:[39m target: nodeWASM type: tfjs: {"imports":1,"importBytes":149,"outputBytes":1378,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-06-08 07:28:01 [35mSTATE:[39m target: nodeWASM type: node: {"imports":41,"importBytes":430552,"outputBytes":376500,"outputFiles":"dist/human.node-wasm.js"}
|
||||
2021-06-08 07:28:01 [35mSTATE:[39m target: browserNoBundle type: tfjs: {"imports":1,"importBytes":2817,"outputBytes":1214,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-06-08 07:28:01 [35mSTATE:[39m target: browserNoBundle type: esm: {"imports":41,"importBytes":430388,"outputBytes":247789,"outputFiles":"dist/human.esm-nobundle.js"}
|
||||
2021-06-08 07:28:02 [35mSTATE:[39m target: browserBundle type: tfjs: {"modules":1684,"moduleBytes":5720339,"imports":7,"importBytes":2817,"outputBytes":2817783,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-06-08 07:28:02 [35mSTATE:[39m target: browserBundle type: iife: {"imports":41,"importBytes":3246957,"outputBytes":1588174,"outputFiles":"dist/human.js"}
|
||||
2021-06-08 07:28:03 [35mSTATE:[39m target: browserBundle type: esm: {"imports":41,"importBytes":3246957,"outputBytes":1588166,"outputFiles":"dist/human.esm.js"}
|
||||
2021-06-08 07:28:03 [36mINFO: [39m Running Linter: ["server/","src/","tfjs/","test/","demo/"]
|
||||
2021-06-08 07:28:27 [36mINFO: [39m Linter complete: files: 71 errors: 0 warnings: 0
|
||||
2021-06-08 07:28:27 [36mINFO: [39m Generate ChangeLog: ["/home/vlado/dev/human/CHANGELOG.md"]
|
||||
2021-06-08 07:28:27 [36mINFO: [39m Generate Typings: ["src/human.ts"] outDir: ["types"]
|
||||
2021-06-08 07:28:43 [36mINFO: [39m Generate TypeDocs: ["src/human.ts"] outDir: ["typedoc"]
|
||||
2021-06-08 07:28:56 [36mINFO: [39m Documentation generated at /home/vlado/dev/human/typedoc 1
|
||||
2021-06-11 16:10:58 [36mINFO: [39m @vladmandic/human version 2.0.1
|
||||
2021-06-11 16:10:58 [36mINFO: [39m User: vlado Platform: linux Arch: x64 Node: v16.0.0
|
||||
2021-06-11 16:10:58 [36mINFO: [39m Toolchain: tfjs: 3.7.0 esbuild 0.12.8; typescript 4.3.2; typedoc: 0.21.0-beta.2 eslint: 7.28.0
|
||||
2021-06-11 16:10:58 [36mINFO: [39m Clean: ["dist/*","types/*","typedoc/*"]
|
||||
2021-06-11 16:10:58 [36mINFO: [39m Build: file startup all type: production config: {"minifyWhitespace":true,"minifyIdentifiers":true,"minifySyntax":true}
|
||||
2021-06-11 16:10:58 [35mSTATE:[39m target: node type: tfjs: {"imports":1,"importBytes":102,"outputBytes":1303,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-06-11 16:10:58 [35mSTATE:[39m target: node type: node: {"imports":41,"importBytes":430797,"outputBytes":376591,"outputFiles":"dist/human.node.js"}
|
||||
2021-06-11 16:10:58 [35mSTATE:[39m target: nodeGPU type: tfjs: {"imports":1,"importBytes":110,"outputBytes":1311,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-06-11 16:10:58 [35mSTATE:[39m target: nodeGPU type: node: {"imports":41,"importBytes":430805,"outputBytes":376595,"outputFiles":"dist/human.node-gpu.js"}
|
||||
2021-06-11 16:10:58 [35mSTATE:[39m target: nodeWASM type: tfjs: {"imports":1,"importBytes":149,"outputBytes":1378,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-06-11 16:10:58 [35mSTATE:[39m target: nodeWASM type: node: {"imports":41,"importBytes":430872,"outputBytes":376667,"outputFiles":"dist/human.node-wasm.js"}
|
||||
2021-06-11 16:10:58 [35mSTATE:[39m target: browserNoBundle type: tfjs: {"imports":1,"importBytes":2817,"outputBytes":1214,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-06-11 16:10:58 [35mSTATE:[39m target: browserNoBundle type: esm: {"imports":41,"importBytes":430708,"outputBytes":247861,"outputFiles":"dist/human.esm-nobundle.js"}
|
||||
2021-06-11 16:10:59 [35mSTATE:[39m target: browserBundle type: tfjs: {"modules":1684,"moduleBytes":5720339,"imports":7,"importBytes":2817,"outputBytes":2817783,"outputFiles":"dist/tfjs.esm.js"}
|
||||
2021-06-11 16:10:59 [35mSTATE:[39m target: browserBundle type: iife: {"imports":41,"importBytes":3247277,"outputBytes":1588248,"outputFiles":"dist/human.js"}
|
||||
2021-06-11 16:11:00 [35mSTATE:[39m target: browserBundle type: esm: {"imports":41,"importBytes":3247277,"outputBytes":1588240,"outputFiles":"dist/human.esm.js"}
|
||||
2021-06-11 16:11:00 [36mINFO: [39m Running Linter: ["server/","src/","tfjs/","test/","demo/"]
|
||||
2021-06-11 16:11:26 [36mINFO: [39m Linter complete: files: 71 errors: 0 warnings: 0
|
||||
2021-06-11 16:11:26 [36mINFO: [39m Generate ChangeLog: ["/home/vlado/dev/human/CHANGELOG.md"]
|
||||
2021-06-11 16:11:26 [36mINFO: [39m Generate Typings: ["src/human.ts"] outDir: ["types"]
|
||||
2021-06-11 16:11:42 [36mINFO: [39m Generate TypeDocs: ["src/human.ts"] outDir: ["typedoc"]
|
||||
2021-06-11 16:11:55 [36mINFO: [39m Documentation generated at /home/vlado/dev/human/typedoc 1
|
||||
|
|
|
@ -49,11 +49,15 @@ async function process(res: Tensor, inputSize, outputShape, config: Config) {
|
|||
const score = Math.trunc(100 * detections[0][id][4]) / 100;
|
||||
const classVal = detections[0][id][5];
|
||||
const label = labels[classVal].label;
|
||||
const boxRaw = [
|
||||
const [x, y] = [
|
||||
detections[0][id][0] / inputSize,
|
||||
detections[0][id][1] / inputSize,
|
||||
detections[0][id][2] / inputSize,
|
||||
detections[0][id][3] / inputSize,
|
||||
];
|
||||
const boxRaw = [
|
||||
x,
|
||||
y,
|
||||
detections[0][id][2] / inputSize - x,
|
||||
detections[0][id][3] / inputSize - y,
|
||||
] as [number, number, number, number];
|
||||
const box = [
|
||||
Math.trunc(boxRaw[0] * outputShape[0]),
|
||||
|
|
|
@ -10,9 +10,10 @@ export const config = {
|
|||
name: 'humangl',
|
||||
priority: 99,
|
||||
canvas: <null | OffscreenCanvas | HTMLCanvasElement>null,
|
||||
gl: <unknown>null,
|
||||
gl: <null | WebGL2RenderingContext>null,
|
||||
width: 1024,
|
||||
height: 1024,
|
||||
extensions: <string[]> [],
|
||||
webGLattr: { // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.2
|
||||
alpha: false,
|
||||
antialias: false,
|
||||
|
@ -25,9 +26,25 @@ export const config = {
|
|||
},
|
||||
};
|
||||
|
||||
function extensions(): void {
|
||||
/*
|
||||
https://www.khronos.org/registry/webgl/extensions/
|
||||
https://webglreport.com/?v=2
|
||||
*/
|
||||
const gl = config.gl;
|
||||
if (!gl) return;
|
||||
config.extensions = gl.getSupportedExtensions() as string[];
|
||||
// gl.getExtension('KHR_parallel_shader_compile');
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers custom WebGL2 backend to be used by Human library
|
||||
*
|
||||
* @returns void
|
||||
*/
|
||||
export function register(): void {
|
||||
if (!tf.findBackend(config.name)) {
|
||||
log('backend registration:', config.name);
|
||||
// log('backend registration:', config.name);
|
||||
try {
|
||||
config.canvas = (typeof OffscreenCanvas !== 'undefined') ? new OffscreenCanvas(config.width, config.height) : document.createElement('canvas');
|
||||
} catch (err) {
|
||||
|
@ -35,7 +52,7 @@ export function register(): void {
|
|||
return;
|
||||
}
|
||||
try {
|
||||
config.gl = config.canvas.getContext('webgl2', config.webGLattr);
|
||||
config.gl = config.canvas.getContext('webgl2', config.webGLattr) as WebGL2RenderingContext;
|
||||
} catch (err) {
|
||||
log('error: cannot get WebGL2 context:', err);
|
||||
return;
|
||||
|
@ -65,13 +82,11 @@ export function register(): void {
|
|||
}
|
||||
try {
|
||||
tf.ENV.set('WEBGL_VERSION', 2);
|
||||
// tf.ENV.set('WEBGL_MAX_TEXTURE_SIZE', config.gl.getParameter(config.gl.MAX_TEXTURE_SIZE));
|
||||
// tf.ENV.set('WEBGL_FORCE_F16_TEXTURES', true);
|
||||
// tf.ENV.set('WEBGL_PACK_DEPTHWISECONV', true);
|
||||
} catch (err) {
|
||||
log('error: cannot set WebGL backend flags:', err);
|
||||
return;
|
||||
}
|
||||
extensions();
|
||||
log('backend registered:', config.name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,10 @@ export declare const config: {
|
|||
name: string;
|
||||
priority: number;
|
||||
canvas: OffscreenCanvas | HTMLCanvasElement | null;
|
||||
gl: unknown;
|
||||
gl: WebGL2RenderingContext | null;
|
||||
width: number;
|
||||
height: number;
|
||||
extensions: string[];
|
||||
webGLattr: {
|
||||
alpha: boolean;
|
||||
antialias: boolean;
|
||||
|
@ -20,4 +21,9 @@ export declare const config: {
|
|||
desynchronized: boolean;
|
||||
};
|
||||
};
|
||||
/**
|
||||
* Registers custom WebGL2 backend to be used by Human library
|
||||
*
|
||||
* @returns void
|
||||
*/
|
||||
export declare function register(): void;
|
||||
|
|
Loading…
Reference in New Issue