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:
Creating a Vision Predictor
First, we fetch a vision model:
1
// Fetch model data from NatML
2
var modelData =await MLModelData.FromHub("@natsuite/ssd-lite");
3
// Deserialize the model
4
var model = modelData.Deserialize();
Copied!
Vision models typically consume an image, and produce one or more outputs depending on what the model does:
See MLImageFeature for all the different ways to create an image feature from existing images or image data.
It is crucial to apply the proper normalization and aspect mode to the image feature, as many vision models will produce wrong outputs without the proper settings.
We can now make a prediction on the image feature:
1
// Make a prediction on the image feature
2
var results = predictor.Predict(imageFeature);
Copied!
Some vision predictors might require multiple inputs. See the README of your predictor for what features to pass in.