Lens Studio v3.0+
Inherits from Component
Transforms inputs (Textures or Float32Array) into outputs (Textures or Float32Array) using a neural network. The neural network is represented by an MLAsset, which is set as the
model property. For more information, see the MLComponent Overview.
build(BasePlaceholder placeholders) :
Builds the MLComponent model when all placeholders are determined. Config is an array of Input and Output placeholders.
Stops running the MLComponent. The
onRunningFinished callback will not be executed.
getInput(String name) :
Returns the InputPlaceholder with the matching name.
getOutput(String name) :
Returns the OutputPlaceholder with the matching name.
Returns the end time of the scheduled MLComponent run.
Returns the start time of the scheduled MLComponent run.
Returns true if running is requested on each frame.
runImmediate(Boolean sync) :
Runs the MLComponent once.
runScheduled(Boolean recurring, MachineLearning.FrameTiming startTiming, MachineLearning.FrameTiming endTiming) :
Schedules the MLComponent to run at the start timing and terminate at the end timing. The scheduled running will recur if
recurring is true.
Stops running the MLComponent.
If loading asynchronously, makes the entire system wait until loading is finished.
If running asynchronously, makes the entire system wait until the last run is finished.
Controls the inference mode that MLComponent will run in. For example, GPU, CPU, etc.
Binary ML model supplied by the user.
Function that gets called when model loading is finished.
Function that gets called when the model stops running.
Render order of the MLComponent.
Returns the current status of the neural network model.
Destroys the component.
Returns the SceneObject the component is attached to.
Returns the Transform this component is attached to.
isSame(SerializableWithUID other) :
Returns true if this object is the same as
other. Useful for checking if two references point to the same thing.
Returns the name of this object’s type.
isOfType(String type) :
Returns true if the object matches or derives from the passed in type.
If disabled, the Component will stop enacting its behavior.
//@input Asset.MLAsset model var mlComponent = script.sceneObject.createComponent('MLComponent'); mlComponent.model = script.model;
Still Looking for help?Visit Support