diff --git a/src/gesture.js b/src/gesture/gesture.js similarity index 90% rename from src/gesture.js rename to src/gesture/gesture.js index 1fa3bde1..5eb8acc5 100644 --- a/src/gesture.js +++ b/src/gesture/gesture.js @@ -22,9 +22,6 @@ exports.face = (res) => { if (!res) return []; const gestures = []; for (const face of res) { - // if (face.annotations['rightCheek'] && face.annotations['leftCheek'] && (face.annotations['rightCheek'].length > 0) && (face.annotations['leftCheek'].length > 0)) { - // gestures.push(`facing ${((face.annotations['rightCheek'][0][2] > 0) || (face.annotations['leftCheek'][0][2] < 0)) ? 'right' : 'left'}`); - // } if (face.mesh && face.mesh.length > 0) { const eyeFacing = face.mesh[35][2] - face.mesh[263][2]; if (Math.abs(eyeFacing) < 10) gestures.push('facing camera'); diff --git a/src/hand/handpose.js b/src/hand/handpose.js index 8a62020b..92ea96ab 100644 --- a/src/hand/handpose.js +++ b/src/hand/handpose.js @@ -69,16 +69,16 @@ exports.HandPose = HandPose; async function load(config) { const [handDetectorModel, handPoseModel] = await Promise.all([ - tf.loadGraphModel(config.hand.detector.modelPath, { fromTFHub: config.hand.detector.modelPath.includes('tfhub.dev') }), - tf.loadGraphModel(config.hand.skeleton.modelPath, { fromTFHub: config.hand.skeleton.modelPath.includes('tfhub.dev') }), + config.hand.enabled ? tf.loadGraphModel(config.hand.detector.modelPath, { fromTFHub: config.hand.detector.modelPath.includes('tfhub.dev') }) : null, + config.hand.landmarks ? tf.loadGraphModel(config.hand.skeleton.modelPath, { fromTFHub: config.hand.skeleton.modelPath.includes('tfhub.dev') }) : null, ]); const detector = new handdetector.HandDetector(handDetectorModel, config.hand.inputSize, anchors.anchors); const pipe = new pipeline.HandPipeline(detector, handPoseModel, config.hand.inputSize); const handpose = new HandPose(pipe); // eslint-disable-next-line no-console - console.log(`Human: load model: ${config.hand.detector.modelPath.match(/\/(.*)\./)[1]}`); + if (config.hand.enabled) console.log(`Human: load model: ${config.hand.detector.modelPath.match(/\/(.*)\./)[1]}`); // eslint-disable-next-line no-console - console.log(`Human: load model: ${config.hand.skeleton.modelPath.match(/\/(.*)\./)[1]}`); + if (config.hand.landmarks) console.log(`Human: load model: ${config.hand.skeleton.modelPath.match(/\/(.*)\./)[1]}`); return handpose; } exports.load = load; diff --git a/src/human.js b/src/human.js index 9cefa571..e55e100e 100644 --- a/src/human.js +++ b/src/human.js @@ -6,7 +6,7 @@ import * as emotion from './emotion/emotion.js'; import * as embedding from './embedding/embedding.js'; import * as posenet from './body/posenet.js'; import * as handpose from './hand/handpose.js'; -import * as gesture from './gesture.js'; +import * as gesture from './gesture/gesture.js'; import * as image from './image.js'; import * as profile from './profile.js'; import * as config from '../config.js';