Using Predictors
In Three Simple Steps
Last updated
Was this helpful?
In Three Simple Steps
Last updated
Was this helpful?
Computer vision is perhaps the most common use case for machine learning. ML allows for solving some interesting vision tasks, like image classification, detection, segmentation, and so on. Across all of these tasks, the NatML workflow is relatively uniform:
First, we create a model:
We can log the model to see what data it consumes and produces:
Then we instantiate the predictor class for the model:
If you are using your own model file, you will have to write a predictor class implementation for it.
You will always want to create the model and predictor once, usually in your Start
method, because it is a time-consuming process.
To make a prediction, we simply need to call Predict
on the predictor:
Some predictors require explicit disposal when they are no longer needed. These predictors define a Dispose
method:
Once the predictor is disposed, the model MUST be disposed.
All predictors (i.e. all types that inherit ) are actually disposable. But most predictors will hide the method if it is not needed.