Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public async poseOutputsToKeypoints(
input: PosenetInput,
heatmapScores: tf.Tensor3D,
offsets: tf.Tensor3D,
displacementFwd: tf.Tensor3D,
displacementBwd: tf.Tensor3D,
padding: Padding,
flipHorizontal = false
) {
const config = {
maxDetections: MAX_PREDICTIONS,
scoreThreshold: 0.5,
nmsRadius: 20
};
const [height, width] = getInputTensorDimensions(input);
const outputStride = this.posenetModel.baseModel.outputStride;
const inputResolution = this.posenetModel.inputResolution;
const [scoresBuffer, offsetsBuffer, displacementsFwdBuffer, displacementsBwdBuffer]
= await toTensorBuffers3D([heatmapScores, offsets, displacementFwd, displacementBwd]);
const poses = await decodeMultiplePoses(scoresBuffer, offsetsBuffer, displacementsFwdBuffer,
displacementsBwdBuffer, outputStride, config.maxDetections, config.scoreThreshold, config.nmsRadius);
const resultPoses = scaleAndFlipPoses(poses, [height, width], inputResolution,
padding, flipHorizontal);
heatmapScores.dispose();
offsets.dispose();
displacementFwd.dispose();