UNPKG

@tensorflow-models/body-pix

Version:

Pretrained BodyPix model in TensorFlow.js

58 lines 2.76 kB
"use strict"; /** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ Object.defineProperty(exports, "__esModule", { value: true }); exports.CONNECTED_PART_INDICES = exports.POSE_CHAIN = exports.PART_IDS = exports.NUM_KEYPOINTS = exports.PART_NAMES = void 0; exports.PART_NAMES = [ 'nose', 'leftEye', 'rightEye', 'leftEar', 'rightEar', 'leftShoulder', 'rightShoulder', 'leftElbow', 'rightElbow', 'leftWrist', 'rightWrist', 'leftHip', 'rightHip', 'leftKnee', 'rightKnee', 'leftAnkle', 'rightAnkle' ]; exports.NUM_KEYPOINTS = exports.PART_NAMES.length; exports.PART_IDS = exports.PART_NAMES.reduce(function (result, jointName, i) { result[jointName] = i; return result; }, {}); var CONNECTED_PART_NAMES = [ ['leftHip', 'leftShoulder'], ['leftElbow', 'leftShoulder'], ['leftElbow', 'leftWrist'], ['leftHip', 'leftKnee'], ['leftKnee', 'leftAnkle'], ['rightHip', 'rightShoulder'], ['rightElbow', 'rightShoulder'], ['rightElbow', 'rightWrist'], ['rightHip', 'rightKnee'], ['rightKnee', 'rightAnkle'], ['leftShoulder', 'rightShoulder'], ['leftHip', 'rightHip'] ]; /* * Define the skeleton. This defines the parent->child relationships of our * tree. Arbitrarily this defines the nose as the root of the tree, however * since we will infer the displacement for both parent->child and * child->parent, we can define the tree root as any node. */ exports.POSE_CHAIN = [ ['nose', 'leftEye'], ['leftEye', 'leftEar'], ['nose', 'rightEye'], ['rightEye', 'rightEar'], ['nose', 'leftShoulder'], ['leftShoulder', 'leftElbow'], ['leftElbow', 'leftWrist'], ['leftShoulder', 'leftHip'], ['leftHip', 'leftKnee'], ['leftKnee', 'leftAnkle'], ['nose', 'rightShoulder'], ['rightShoulder', 'rightElbow'], ['rightElbow', 'rightWrist'], ['rightShoulder', 'rightHip'], ['rightHip', 'rightKnee'], ['rightKnee', 'rightAnkle'] ]; exports.CONNECTED_PART_INDICES = CONNECTED_PART_NAMES.map(function (_a) { var jointNameA = _a[0], jointNameB = _a[1]; return ([exports.PART_IDS[jointNameA], exports.PART_IDS[jointNameB]]); }); //# sourceMappingURL=keypoints.js.map