-
Notifications
You must be signed in to change notification settings - Fork 28
Classic API: Machine Learning
Parent Document: ANT APIs
Machine Learning API is the set of APIs for running inference with leveraging machine learning algorithms such as ANN(artificial neural networks), DNN(deep neural networks).
You need to load machine learning API(MLAPI) object before you use its API as following. With MLAPI, you can retrieve MLAPIInferenceUnit object from this MLAPI object.
var mlApi = require(process.env.ANT_BIN_DIR + 'ant').ml();void loadAsync(String modelPackagePath, Object params, Function callback)
callback: void (Object iu)
It makes machine learning daemon read machine learning model descriptor which is located at modelPackagePath, and creates an InferenceUnit object. The loaded InferenceUnit object will be registered to inference unit directory. After loading, callback will be called with the inference unit as argument iu.
-
Argument 0: String modelPackagePath
Absolute path of machine learning model’s descriptor file
-
Argument 1: Object params
Parameter of inference unit. It can accept only parameters that is defined in model descriptor.
-
Argument 2: Function callback
- Callback Argument 0: Object iu
-
Return: void
void getInferenceUnitsAsync(Function callback)
callback: void (Array<Object> ius)
It retrieves the list of inference units that are registered to inference unit directory of MLDaemon. After retrieving inference unit list, callback will be called with the list as argument ius.
- Argument 0: Function callback
- Callback Argument 0: Array<Object> ius
- Return: void
MLAPIInferenceUnit object represents InferenceUnit running on the machine learning framework, the basic unit of machine learning inference.
void setInputAsync(String sourceUri, String inputName, Function callback)
callback: void (void)
It sets a connection of an input source(of which URI is sourceUri) and a input of inference unit(of which name is inputName).
-
Argument 0: String inputName
The name of inference unit’s input
-
Argument 1: String sourceUri
The URI of input source. If
sourceUriis null or empty string, reset the connection. -
Argument 2: Function callback
Callback function called when setting input is done.
-
Return: void
void setOnOutputAsync(Function callback)
callback: void (Object outputs)
It sets callback of output event which occurs after running InferenceUnit.
-
Argument 0: Function callback
Callback function which handles output event of machine learning inference. If callback is null, reset the callback.
- Callback Argument 0: Object outputs
-
Return: void
void startAsync(Function callback)
callback: void (void)
It starts the execution of InferenceUnit.
-
Argument 0: Function callback
- Callback function when the command is finished
- Return: void
void stopAsync(Function callback)
callback: void (void)
It stops the execution of InferenceUnit.
-
Argument 0: Function callback
- Callback function when the command is finished
- Return: void
void unloadAsync(Function callback)
callback: void (void)
It unloads the InferenceUnit.
-
Argument 0: Function callback
- Callback function when the command is finished
- Return: void
String name
Human-readable name of InferenceUnit
String type
The type of InferenceUnit
- Home
- About
- Getting Started
-
ANT APIs
- ANT Classic API
- ANT Lite API
- Getting Involved