mirror of https://github.com/vladmandic/human
move gl flags to correct location
parent
718ccda645
commit
f9306abac5
|
@ -11,6 +11,7 @@ Repository: **<git+https://github.com/vladmandic/human.git>**
|
|||
|
||||
### **HEAD -> main** 2021/03/28 mandic00@live.com
|
||||
|
||||
- remove debug output
|
||||
- new face rotation calculations
|
||||
- cleanup
|
||||
- rotationmatrixtoeulerangle, and fixes
|
||||
|
|
|
@ -7,7 +7,7 @@ const userConfig = { backend: 'webgl' }; // add any user configuration overrides
|
|||
|
||||
/*
|
||||
const userConfig = {
|
||||
backend: 'webgl',
|
||||
backend: 'humangl',
|
||||
async: false,
|
||||
profile: false,
|
||||
warmup: 'full',
|
||||
|
@ -24,7 +24,7 @@ const userConfig = {
|
|||
body: { enabled: false },
|
||||
// body: { enabled: true, modelPath: '../models/blazepose.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) {
|
||||
let part;
|
||||
const points: any[] = [];
|
||||
// torso
|
||||
// shoulder line
|
||||
points.length = 0;
|
||||
part = result[i].keypoints.find((a) => a.part === 'leftShoulder');
|
||||
if (part && part.score > defaults.body.scoreThreshold) points.push([part.position.x, part.position.y]);
|
||||
part = result[i].keypoints.find((a) => a.part === 'rightShoulder');
|
||||
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');
|
||||
if (part && part.score > defaults.body.scoreThreshold) points.push([part.position.x, part.position.y]);
|
||||
part = result[i].keypoints.find((a) => a.part === 'leftHip');
|
||||
if (part && part.score > defaults.body.scoreThreshold) points.push([part.position.x, part.position.y]);
|
||||
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 (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
|
||||
points.length = 0;
|
||||
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 !== '') {
|
||||
// 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_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.backend === 'wasm') {
|
||||
|
@ -291,18 +293,14 @@ export class Human {
|
|||
}
|
||||
}
|
||||
this.tf.enableProdMode();
|
||||
/* debug mode is really too mcuh
|
||||
this.tf.enableDebugMode();
|
||||
*/
|
||||
this.tf.ENV.set('CHECK_COMPUTATION_FOR_ERRORS', false);
|
||||
this.tf.ENV.set('WEBGL_PACK_DEPTHWISECONV', true);
|
||||
if (this.tf.getBackend() === 'webgl') {
|
||||
// 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('WEBGL_PACK_DEPTHWISECONV', true);
|
||||
if (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_FORCE_F16_TEXTURES', true);
|
||||
// this.tf.ENV.set('WEBGL_PACK_DEPTHWISECONV', true);
|
||||
const gl = await this.tf.backend().getGPGPUContext().gl;
|
||||
if (this.config.debug) log(`gl version:${gl.getParameter(gl.VERSION)} renderer:${gl.getParameter(gl.RENDERER)}`);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue