ML.NET and the magic of Model Builder using the ASL alphabet

Pablito Piova
4 min readDec 23, 2021

ML.NET Model Builder is an intuitive graphical Visual Studio extension to build, train, and deploy custom machine learning models.

First I share a link on how to install ML.NET Model Builder and also the link of the extension for Visual Studio 2022.

Model Builder uses automated machine learning (AutoML) to explore different machine learning algorithms and settings to help you find the one that best suits your scenario.

You don’t need machine learning expertise to use Model Builder. All you need is some data, and a problem to solve. Model Builder generates the code to add the model to your .NET application.

I share the link of the complete documentation provided by the ML.NET team.

I hope you can review the links and now get to work with Model Builder.

In our beginning, we need to classify images recognizing the Alphabet Sing Language, so I looked for a dataset with images to train the model, and guess what, I found it in Kaggle, haha. I share the link so that you can download this image dataset.

Now we continue going to our Visual Studio and creating a console application in Net 6.

In Solution Explorer, right-click your newly created console application project and select Add > Machine Learning to launch Model Builder.

Once you’re presented with the scenario screen, select Image Classification and proceed to the next step.

You continue with the Environment tab. For image classification scenarios, you can choose 3 options:

  • Local (CPU): Use our local machine to train the model.
  • Local (GPU): Use our local machine with GPU to train the model. I share a link to how to install GPU support in Model Builder.
  • Azure: You can use Azure cloud resources to train models with Model Builder. I share a link to create processes in Azure Machine Learning.

In this example we use Local CPU to train the model.

In the Add data screen, load your data by selecting the button next to the Select a folder text box and use the file explorer to find the unzipped directory containing the subdirectories with images.

After completing the load images, we are ready to start training the model. For this sample of 87,000 images, the training took approximately 3 hours.

Below you can see in the image how Model Builder used the algorithm to train these models. It is a deep neural network based on the ResNet50 (DNN + ResNet50) architecture for image classification.

On the evaluation screen, you can get an overview of the results of the training process, such as the time it took for the model to train and the accuracy. Additionally, you can use the “Try your model” experience to see if the model is working as expected. In my case I used images taken by my webcam testing the letters of my nickname “ P I O V A ”.
The model classifies the image and shows me the probabilities of the prediction.

Result prediction letter P

Result prediction letter I

Result prediction letter O

Result prediction letter V

Result prediction letter A

In this case the prediction is not correct. In both images the probability is not as expected.

We should keep training and testing the model until we are satisfied with the results.

If you are satisfied with your model, select the Consume screen to add the code and make predictions.
In the Consume screen, select the Add Projects button to add the auto-generated projects to your solution.

--

--

Pablito Piova

Microsoft MVP | .NET | Azure Cloud | Azure Cognitive Services | Microsoft Technologies | MLNET | Machine Learning & Artificial Intelligence Lover