mirror of https://github.com/vladmandic/human
modularize pipeline models
parent
0e6ac7048b
commit
6c6503768a
|
@ -22,9 +22,6 @@ exports.face = (res) => {
|
||||||
if (!res) return [];
|
if (!res) return [];
|
||||||
const gestures = [];
|
const gestures = [];
|
||||||
for (const face of res) {
|
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) {
|
if (face.mesh && face.mesh.length > 0) {
|
||||||
const eyeFacing = face.mesh[35][2] - face.mesh[263][2];
|
const eyeFacing = face.mesh[35][2] - face.mesh[263][2];
|
||||||
if (Math.abs(eyeFacing) < 10) gestures.push('facing camera');
|
if (Math.abs(eyeFacing) < 10) gestures.push('facing camera');
|
|
@ -69,16 +69,16 @@ exports.HandPose = HandPose;
|
||||||
|
|
||||||
async function load(config) {
|
async function load(config) {
|
||||||
const [handDetectorModel, handPoseModel] = await Promise.all([
|
const [handDetectorModel, handPoseModel] = await Promise.all([
|
||||||
tf.loadGraphModel(config.hand.detector.modelPath, { fromTFHub: config.hand.detector.modelPath.includes('tfhub.dev') }),
|
config.hand.enabled ? tf.loadGraphModel(config.hand.detector.modelPath, { fromTFHub: config.hand.detector.modelPath.includes('tfhub.dev') }) : null,
|
||||||
tf.loadGraphModel(config.hand.skeleton.modelPath, { fromTFHub: config.hand.skeleton.modelPath.includes('tfhub.dev') }),
|
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 detector = new handdetector.HandDetector(handDetectorModel, config.hand.inputSize, anchors.anchors);
|
||||||
const pipe = new pipeline.HandPipeline(detector, handPoseModel, config.hand.inputSize);
|
const pipe = new pipeline.HandPipeline(detector, handPoseModel, config.hand.inputSize);
|
||||||
const handpose = new HandPose(pipe);
|
const handpose = new HandPose(pipe);
|
||||||
// eslint-disable-next-line no-console
|
// 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
|
// 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;
|
return handpose;
|
||||||
}
|
}
|
||||||
exports.load = load;
|
exports.load = load;
|
||||||
|
|
|
@ -6,7 +6,7 @@ import * as emotion from './emotion/emotion.js';
|
||||||
import * as embedding from './embedding/embedding.js';
|
import * as embedding from './embedding/embedding.js';
|
||||||
import * as posenet from './body/posenet.js';
|
import * as posenet from './body/posenet.js';
|
||||||
import * as handpose from './hand/handpose.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 image from './image.js';
|
||||||
import * as profile from './profile.js';
|
import * as profile from './profile.js';
|
||||||
import * as config from '../config.js';
|
import * as config from '../config.js';
|
||||||
|
|
Loading…
Reference in New Issue