mirror of https://github.com/vladmandic/human
move gl flags to correct location
parent
957872e5a1
commit
6d978c0b9b
|
@ -11,6 +11,7 @@ Repository: **<git+https://github.com/vladmandic/human.git>**
|
||||||
|
|
||||||
### **HEAD -> main** 2021/03/28 mandic00@live.com
|
### **HEAD -> main** 2021/03/28 mandic00@live.com
|
||||||
|
|
||||||
|
- remove debug output
|
||||||
- new face rotation calculations
|
- new face rotation calculations
|
||||||
- cleanup
|
- cleanup
|
||||||
- rotationmatrixtoeulerangle, and fixes
|
- rotationmatrixtoeulerangle, and fixes
|
||||||
|
|
|
@ -7,7 +7,7 @@ const userConfig = { backend: 'webgl' }; // add any user configuration overrides
|
||||||
|
|
||||||
/*
|
/*
|
||||||
const userConfig = {
|
const userConfig = {
|
||||||
backend: 'webgl',
|
backend: 'humangl',
|
||||||
async: false,
|
async: false,
|
||||||
profile: false,
|
profile: false,
|
||||||
warmup: 'full',
|
warmup: 'full',
|
||||||
|
@ -24,7 +24,7 @@ const userConfig = {
|
||||||
body: { enabled: false },
|
body: { enabled: false },
|
||||||
// body: { enabled: true, modelPath: '../models/blazepose.json' },
|
// body: { enabled: true, modelPath: '../models/blazepose.json' },
|
||||||
// body: { enabled: true, modelPath: '../models/efficientpose.json' },
|
// body: { enabled: true, modelPath: '../models/efficientpose.json' },
|
||||||
object: { enabled: false },
|
object: { enabled: true },
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -231,19 +231,24 @@ export async function body(inCanvas: HTMLCanvasElement, result: Array<any>) {
|
||||||
if (drawOptions.drawPolygons && result[i].keypoints) {
|
if (drawOptions.drawPolygons && result[i].keypoints) {
|
||||||
let part;
|
let part;
|
||||||
const points: any[] = [];
|
const points: any[] = [];
|
||||||
// torso
|
// shoulder line
|
||||||
points.length = 0;
|
points.length = 0;
|
||||||
part = result[i].keypoints.find((a) => a.part === 'leftShoulder');
|
part = result[i].keypoints.find((a) => a.part === 'leftShoulder');
|
||||||
if (part && part.score > defaults.body.scoreThreshold) points.push([part.position.x, part.position.y]);
|
if (part && part.score > defaults.body.scoreThreshold) points.push([part.position.x, part.position.y]);
|
||||||
part = result[i].keypoints.find((a) => a.part === 'rightShoulder');
|
part = result[i].keypoints.find((a) => a.part === 'rightShoulder');
|
||||||
if (part && part.score > defaults.body.scoreThreshold) points.push([part.position.x, part.position.y]);
|
if (part && part.score > defaults.body.scoreThreshold) points.push([part.position.x, part.position.y]);
|
||||||
|
curves(ctx, points);
|
||||||
|
// torso main
|
||||||
|
points.length = 0;
|
||||||
|
part = result[i].keypoints.find((a) => a.part === 'rightShoulder');
|
||||||
|
if (part && part.score > defaults.body.scoreThreshold) points.push([part.position.x, part.position.y]);
|
||||||
part = result[i].keypoints.find((a) => a.part === 'rightHip');
|
part = result[i].keypoints.find((a) => a.part === 'rightHip');
|
||||||
if (part && part.score > defaults.body.scoreThreshold) points.push([part.position.x, part.position.y]);
|
if (part && part.score > defaults.body.scoreThreshold) points.push([part.position.x, part.position.y]);
|
||||||
part = result[i].keypoints.find((a) => a.part === 'leftHip');
|
part = result[i].keypoints.find((a) => a.part === 'leftHip');
|
||||||
if (part && part.score > defaults.body.scoreThreshold) points.push([part.position.x, part.position.y]);
|
if (part && part.score > defaults.body.scoreThreshold) points.push([part.position.x, part.position.y]);
|
||||||
part = result[i].keypoints.find((a) => a.part === 'leftShoulder');
|
part = result[i].keypoints.find((a) => a.part === 'leftShoulder');
|
||||||
if (part && part.score > defaults.body.scoreThreshold) points.push([part.position.x, part.position.y]);
|
if (part && part.score > defaults.body.scoreThreshold) points.push([part.position.x, part.position.y]);
|
||||||
if (points.length === 5) lines(ctx, points); // only draw if we have complete torso
|
if (points.length === 4) lines(ctx, points); // only draw if we have complete torso
|
||||||
// leg left
|
// leg left
|
||||||
points.length = 0;
|
points.length = 0;
|
||||||
part = result[i].keypoints.find((a) => a.part === 'leftHip');
|
part = result[i].keypoints.find((a) => a.part === 'leftHip');
|
||||||
|
|
14
src/human.ts
14
src/human.ts
|
@ -270,8 +270,10 @@ export class Human {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (this.config.backend && this.config.backend !== '') {
|
if (this.config.backend && this.config.backend !== '') {
|
||||||
|
// force browser vs node backend
|
||||||
if (this.tf.ENV.flags.IS_BROWSER && this.config.backend === 'tensorflow') this.config.backend = 'webgl';
|
if (this.tf.ENV.flags.IS_BROWSER && this.config.backend === 'tensorflow') this.config.backend = 'webgl';
|
||||||
if (this.tf.ENV.flags.IS_NODE && (this.config.backend === 'webgl' || this.config.backend === 'wasm')) this.config.backend = 'tensorflow';
|
if (this.tf.ENV.flags.IS_NODE && (this.config.backend === 'webgl' || this.config.backend === 'wasm')) this.config.backend = 'tensorflow';
|
||||||
|
|
||||||
if (this.config.debug) log('setting backend:', this.config.backend);
|
if (this.config.debug) log('setting backend:', this.config.backend);
|
||||||
|
|
||||||
if (this.config.backend === 'wasm') {
|
if (this.config.backend === 'wasm') {
|
||||||
|
@ -291,18 +293,14 @@ export class Human {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.tf.enableProdMode();
|
this.tf.enableProdMode();
|
||||||
/* debug mode is really too mcuh
|
// this.tf.enableDebugMode();
|
||||||
this.tf.enableDebugMode();
|
if (this.tf.getBackend() === 'webgl' || this.tf.getBackend() === 'humangl') {
|
||||||
*/
|
this.tf.ENV.set('CHECK_COMPUTATION_FOR_ERRORS', false);
|
||||||
this.tf.ENV.set('CHECK_COMPUTATION_FOR_ERRORS', false);
|
this.tf.ENV.set('WEBGL_PACK_DEPTHWISECONV', true);
|
||||||
this.tf.ENV.set('WEBGL_PACK_DEPTHWISECONV', true);
|
|
||||||
if (this.tf.getBackend() === 'webgl') {
|
|
||||||
if (this.config.deallocate) {
|
if (this.config.deallocate) {
|
||||||
log('changing webgl: WEBGL_DELETE_TEXTURE_THRESHOLD:', this.config.deallocate);
|
log('changing webgl: WEBGL_DELETE_TEXTURE_THRESHOLD:', this.config.deallocate);
|
||||||
this.tf.ENV.set('WEBGL_DELETE_TEXTURE_THRESHOLD', this.config.deallocate ? 0 : -1);
|
this.tf.ENV.set('WEBGL_DELETE_TEXTURE_THRESHOLD', this.config.deallocate ? 0 : -1);
|
||||||
}
|
}
|
||||||
// this.tf.ENV.set('WEBGL_FORCE_F16_TEXTURES', true);
|
|
||||||
// this.tf.ENV.set('WEBGL_PACK_DEPTHWISECONV', true);
|
|
||||||
const gl = await this.tf.backend().getGPGPUContext().gl;
|
const gl = await this.tf.backend().getGPGPUContext().gl;
|
||||||
if (this.config.debug) log(`gl version:${gl.getParameter(gl.VERSION)} renderer:${gl.getParameter(gl.RENDERER)}`);
|
if (this.config.debug) log(`gl version:${gl.getParameter(gl.VERSION)} renderer:${gl.getParameter(gl.RENDERER)}`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue