It was a placer to share some amazing time with the Mississauga .Net User Group last night in my last session of the decade. It was a full night focused on Artificial Intelligence and Machine Learning, and as usual is time to share the resources used in the session.
I’m getting ready for my last event of the year, and I just realize that in the latest update of Model Builder, we have the chance to build our own Image Classifier scenario. Let’s start with the official Model Builder definition (see references):
ML.NET Model Builder provides an easy to understand visual interface to build, train, and deploy custom machine learning models. Prior machine learning expertise is not required. Model Builder supports AutoML, which automatically explores different machine learning algorithms and settings to help you find the one that best suits your scenario.
Working with images was supported for a while in Machine Learning.Net. In the Machine Learning .Net Samples, we have sample scenarios like
Image Classification Model Training – Preferred API (Based on native TensorFlow transfer learning)
In this sample app you create your own custom image classifier model by natively training a TensorFlow model from ML.NET API with your own images.
We even have an amazing tutorial, to create our own image classification model from zero
Tutorial: Generate an ML.NET image classification model from a pre-trained TensorFlow model
Learn how to transfer the knowledge from an existing TensorFlow model into a new ML.NET image classification model. The TensorFlow model was trained to classify images into a thousand categories. The ML.NET model makes use of part of the TensorFlow model in its pipeline to train a model to classify images into 3 categories.
Training an Image Classification model from scratch requires setting millions of parameters, a ton of labeled training data and a vast amount of compute resources (hundreds of GPU hours). While not as effective as training a custom model from scratch, transfer learning allows you to shortcut this process by working with thousands of images vs. millions of labeled images and build a customized model fairly quickly (within an hour on a machine without a GPU). This tutorial scales that process down even further, using only a dozen training images.
And now, I found that Model Builder, also supports an Image Classification Scenario.
It follows the Model Builder standard workflow, starting with the selection of the scenario:
And then selecting a folder with the Images.
Important: Model Builder expects image data to be JPG or PNG files organized in folders that correspond to the categories of the classification.
To load images into Model Builder, provide the path to a single top-level directory:
This top-level directory contains one subfolder for each of the categories to predict.
Each subfolder contains the image files belonging to its category.
Once the folder is selected, we can see a preview of the images and labels loaded from the folder.
For more information about how to organize images for this scenario, refer to Load training data into Model Builder.
And now we start the training process. This may take a while, depending on your hardware. I’m using the sample set of drawings that we used on the InsiderDev Tour, for Custom Vision. These are 24 drawings images, with 3 labels, and in a PC with a I7, 32GB of Ram and an SSD, the training process took a little longer than 2 minutes.
Once the training is complete, we have a decent accuracy in our model, so it’s time to test. Before Model Builder last step, we have the chance to test the model with some test images.
Using one of the images that I created at Ignite in Orlando, the trained model get’s a human with a 99% of accuracy.
And, the final step is to add the generated model and code to our project. I’ll write about how to use this generated code on the near future.
It was a
placer to share some amazing time with the Metro Toronto .Net User Group. Last
night was also a special one, we hosted the event at the amazing @MarsDD it was
great to have a huge group interested in Artificial Intelligence.
it’s time to share the resources of the event
During the next couple of months, I’ll be sharing some amazing experiences around AI. Some of these experiences includes IoT devices like a Raspberry Pi, and of course some Machine Learning.Net (ML.Net). Because ML.Net is built with .Net Core, it makes sense to share the 5 simple steps you need to do to install .Net Core in a Raspberry Pi.
my 1st try was to navigate to the official .Net page (see
references), which automatically detect my Linux distro and proposes a set of
completely sure that I’m working in a 32 bits environment, however I’ll double
check this with the following commands
sudo apt-get install lshw lshw
After installing lshw I confirm that I’m in a 32 bit environment
Bonus: lshw is a small tool to extract detailed information on the hardware configuration of the machine. It can report exact memory configuration, firmware version, mainboard configuration, CPU version and speed, cache configuration, bus speed, etc. on DMI-capable x86 or IA-64 systems and on some PowerPC machines (PowerMac G4 is known to work).
Now I need to navigate to the download page to download the
specific Linux 32-bit version (see references).
Once I got the image downloaded its time to extract the file
on a specific folder. I’ve created a folder named “dotnet” with the following command
sudo mkdir -p dotnet
And to extract the image from the Downloads folder
sudo tar zxf dotnet-sdk-2.2.401-linux-arm.tar.gz -C
Let’s create a symbolic link to the extracted binaries
sudo ln -s /home/pi/dotnet/dotnet /usr/local/bin
And it’s done! Let’s invoke the .DotNet help command to test
Now we can follow the steps of [.NET Core on Raspberry Pi,
see references] to create a Console Application and to test the device.
To create a new console App
dotnet new console
And test the app
sudo dotnet run
We can publish the app for linux / raspberry pi
sudo dotnet publish -r linux-arm
And copy the generated folder to be used in another device
So next steps will be some other tests with Raspberry Pi and
.Net Core. And the following image is a big teaser of this
recursos para comenzar a aprender Machine Learning. Sin embargo, suele ser
complicado elegir uno que realmente se adapte a nuestro perfil, y que nos
permita aprender de forma coherente y concisa los principios de Machine
Learning. Si trabajas con tecnologías Microsoft o eres un programador .Net,
este curso es para ti.
curso veremos los conceptos principales que explican el estado actual de
Machine Learning; y aprenderemos utilizando ML.NET (Machine Learning.Net ).
ML.Net es un conjunto de herramientas que ha alcanzado de forma oficial su
versión Release y que será la base del aprendizaje de Machine Learning. Veremos
escenarios para aprendizaje supervisado y no supervisado, escenarios de
análisis de sentimientos de texto, escenarios de integración con otras
tecnologías de ML, como ONNX o TensorFlow, y mucho más.