improve gaze and face angle visualizations in draw

pull/356/head
Vladimir Mandic 2021-10-07 10:33:10 -04:00
parent 65888d82a7
commit 293eba8379
3 changed files with 9 additions and 7 deletions

View File

@ -31,6 +31,8 @@ import jsonView from './helpers/jsonview.js';
let human;
let userConfig = {
body: { enabled: false },
hand: { enabled: false },
/*
warmup: 'none',
backend: 'humangl',
@ -408,7 +410,7 @@ async function setupCamera() {
const track = stream.getVideoTracks()[0];
const settings = track.getSettings();
if (initialCameraAccess) log('selected video source:', track, settings); // log('selected camera:', track.label, 'id:', settings.deviceId);
ui.camera = { name: track.label.toLowerCase(), width: video.videoWidth, height: video.videoHeight, facing: settings.facingMode === 'user' ? 'front' : 'back' };
ui.camera = { name: track.label.toLowerCase(), width: settings.width, height: settings.height, facing: settings.facingMode === 'user' ? 'front' : 'back' };
initialCameraAccess = false;
if (!stream) return 'camera stream empty';

View File

@ -51,7 +51,7 @@ export async function check(instance, force = false) {
if (instance.config.debug) log('setting backend:', instance.config.backend);
// handle wasm
// customize wasm
if (instance.config.backend === 'wasm') {
if (instance.config.debug) log('wasm path:', instance.config.wasmPath);
if (typeof tf?.setWasmPaths !== 'undefined') await tf.setWasmPaths(instance.config.wasmPath);
@ -71,13 +71,13 @@ export async function check(instance, force = false) {
}
}
// handle webgl & humangl
// customize humangl
if (tf.getBackend() === 'humangl') {
tf.ENV.set('CHECK_COMPUTATION_FOR_ERRORS', false);
tf.ENV.set('WEBGL_CPU_FORWARD', true);
tf.ENV.set('WEBGL_PACK_DEPTHWISECONV', false);
tf.ENV.set('WEBGL_USE_SHAPES_UNIFORMS', true);
tf.ENV.set('CPU_HANDOFF_SIZE_THRESHOLD', 128);
tf.ENV.set('CPU_HANDOFF_SIZE_THRESHOLD', 256);
// if (!instance.config.object.enabled) tf.ENV.set('WEBGL_FORCE_F16_TEXTURES', true); // safe to use 16bit precision
if (typeof instance.config['deallocate'] !== 'undefined' && instance.config['deallocate']) { // hidden param
log('changing webgl: WEBGL_DELETE_TEXTURE_THRESHOLD:', true);
@ -89,9 +89,9 @@ export async function check(instance, force = false) {
}
}
// handle webgpu
// customize webgpu
if (tf.getBackend() === 'webgpu') {
tf.ENV.set('WEBGPU_USE_GLSL', true);
tf.ENV.set('WEBGPU_CPU_HANDOFF_SIZE_THRESHOLD', 256);
}
// wait for ready

View File

@ -32,7 +32,7 @@ export * from '@tensorflow/tfjs-backend-webgl/dist/index.js';
export * from '@tensorflow/tfjs-backend-wasm/dist/index.js';
// add webgpu to bundle, experimental
// export * from '@tensorflow/tfjs-backend-webgpu/dist/index.js';
export * from '@tensorflow/tfjs-backend-webgpu/dist/index.js';
// export versions, overrides version object from @tensorflow/tfjs
export { version } from '../dist/tfjs.version.js';