Recognize or classify the type of image using ML.net

We’ll see how to train our machine learning model to make it capable of classifying the images present in our local folder. We will be using ML.net in this project.

Objective of this project is to provide birds images as input to create the model and then we’ll test the model. We will provide two kinds of birds’ image in our example. One parrot and another pigeon. Then we’ll give any kind of image to recognize, then we’ll see whether the algorithm is able to recognize the image correctly or not.

But first let’s talk about ML.NET and how know does it work?

ML.NET is an open-source Machine Learning platform that allows us to transform input data into an ML model, then this model can be used as algorithm. In our case the model is trained to recognize then image only. ML.Net has many other ways to train its model via text/image and other.

The framework also provide way to connect to the model or consume the model via a web application or via console or Web API.

 

 Prerequisites and Solution Preparation in Visual Studio

1 – We will be using Visual Studio 2022, We will use the Model Builder Interpreter of ML.Net. we will need to have the following workload in VS.

2 – Keep a folder where there are two types of birds in the child folder like this. Note that we are also having two images to test, each one of parrot and one of a pigeon.

 

 So Let’s get started!

1 – Create a project using VS 2022, select Console App

Choose option to Add -> Choose Machine Learning Model..