npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@jspsych-contrib/extension-mediapipe-face-mesh

v2.0.0

Published

A jsPsych extension for online tracking of facial posture during trials using the MediaPipe Face Mesh library

Downloads

19

Readme

mediapipe-face-mesh extension

Overview

This extension provides online tracking of facial posture during trials using the MediaPipe Face Mesh library. It currently records the estimated 3D translation and rotation.

The primary purpose of this extension is to use it in plugins. For instance, it allows creation of interactive virtual mirror paradigms similar to the Open Virtual Mirror Framework. However, it can also be used as an online face tracker if recording of sensitive facial data can be avoided. Refer to trial parameters for more details.

Loading

In browser

<script src="https://unpkg.com/@jspsych-contrib/[email protected]">

Via NPM

npm install @jspsych-contrib/extension-mediapipe-face-mesh
import jsPsychExtensionMediapipeFacemesh from '@jspsych-contrib/extension-mediapipe-face-mesh';

Compatibility

This extension was developed for, and tested with jsPsych v7.3.0.

Documentation

Initialization Parameters

Initialization parameters can be set when calling initJsPsych()

initJsPsych({
  extensions: [
    {type: jsPsychExtensionMediapipeFacemesh, params: {...}}
  ]
})

Parameter | Type | Default Value | Description ----------|------|---------------|------------ locateFile | function | see source | The function that is used to locate the binary blobs used by the face_mesh tracker.

Trial Parameters

Trial parameters can be set when adding the extension to a trial object.

var trial = {
  type: jsPsych...,
  extensions: [
    {type: jsPsychExtensionMediapipeFacemesh, params: {...}}
  ]
}

Parameter | Type | Default Value | Description ----------|------|---------------|------------ record | boolean | false | Should the data generated as described below recorded or immediately discarded. Please note, that long recording might require lots of memory.

Data Generated

In addition to the default data collected by all plugins, this plugin collects all parameter data described above and the following data for each trial.

| Name | Type | Value | | ---------------- | ----------- | ---------------------------------------- | | frame_id | numeric | The ID of the frame from which the tracking data was obtained | | transformation | [numeric] | Array containing the full 3x4 transformation matrix for homogeneous coordinates. See MediaPipe doc for more details.| | rotation | [numeric] | Array containing the Euler rotation angles in XYZ order. | | translation | [numeric] | Array containing the translation along XYZ axes. |

Usage in other plugins

This extension allows creation of interactive experiments, e.g., virtual mirrors as in this project. Here is an example of the sage of the extension from another plugin:

  class MyInteractivePlugin {

    constructor(jsPsych) {
        this.jsPsych = jsPsych;
        this.mediapipe = this.jsPsych.extensions["mediapipe-face-mesh"];
    }

    trial(display_element, trial) {

        const callback = (trackingResult) => {
            console.log(trackingResult);
        };

        this.mediapipe.addTrackingResultCallback(callback);

        // Do some stuff

        this.jsPsych.pluginAPI.setTimeout(
            () => {
                this.mediapipe.removeTrackingResultCallback(callback);
                this.jsPsych.finishTrial();
            },
            trial["trial_duration"]);
    }