Class: XmmProcessor

XmmProcessor

Representation of a gesture model. A instance of XmmProcessor can train a model from examples and can perform classification and/or regression depending on the chosen algorithm.

The training is currently based on the presence of a remote server-side API, that must be able to process rapidMix compliant JSON formats.

Constructor

new XmmProcessor(options)

Parameters:
Name Type Description
options Object

Override default parameters

Properties
Name Type Attributes Default Description
url String <optional>
'https://como.ircam.fr/api/v1/train'

Url of the training end point.

Source:
Example
import * as mano from 'mano-js/client';

const processedSensors = new mano.ProcessedSensors();
const example = new mano.Example();
const trainingSet = new mano.TrainingSet();
const xmmProcessor = new mano.XmmProcesssor();

example.setLabel('test');
processedSensors.addListener(example.addElement);

// later
processedSensors.removeListener(example.addElement);
const rapidMixJsonExample = example.toJSON();

trainingSet.addExample(rapidMixJsonExample);
const rapidMixJsonTrainingSet = trainingSet.toJSON();

xmmProcessor
  .train(rapidMixJsonTrainingSet)
  .then(() => {
    // start decoding
    processedSensors.addListener(data => {
      const results = xmmProcessor.run(data);
      console.log(results);
    });
  });

Methods

getConfig() → {Object}

RapidMix compliant configuration object.

Source:
Returns:
  • RapidMix Configuration object.
Type
Object

getModel() → {Object}

Retrieve the model in RapidMix model format.

Source:
Returns:
  • Current RapidMix Model object.
Type
Object

reset()

Reset the model's temporal decoding state. Is only valid on hhmm decoder.

Source:

run(vector) → {Object}

Perform the calssification or the regression of the given vector.

Parameters:
Name Type Description
vector Float32Array | Array

Input vector for the decoding.

Source:
Returns:

results - Object containing the decoding results.

Type
Object

setConfig(config)

Set the model configuration parameters (or a subset of them).

Parameters:
Name Type Description
config Object

RapidMix JSON configuration object or subset of parameters.

Source:

setModel(model)

Use the given RapidMix model object for the decoding.

Parameters:
Name Type Description
model Object

RapidMix Model object.

Source:

train(trainingSet) → {Promise}

Train the model according to the given TrainingSet. In this implmentation the training is performed server-side and rely on an XHR call.

Parameters:
Name Type Description
trainingSet JSON

RapidMix compliant JSON formatted training set

Source:
Returns:
  • Promise that resolves on the API response (RapidMix API response format), when the model is updated.
Type
Promise