Leçon 1, Chapitre 1
En cours

Machine Learning – Défis Algorithme pour classifier des images

Yann KIDSHAKER 18 mars 2026

Introduction to Image Classifier

The Image Classifier of the PictoBlox Machine Learning Environment is used for classifying images into different classes based on their characteristics. 

For example, let’s say you want to construct a model to judge if a person is wearing a mask correctly or not, or if the person’s wearing one at all. You’ll have to classify your image into three classes:

  1. Wearing mask

  2. Not wearing mask
  3. Wearing mask incorrectly

This is the case of image classification where you want the machine to label the images into one of the classes.

In this tutorial, we’ll learn how to construct the ML model using the PictoBlox Image Classifier.

Following are the steps involved in the procedure:

  1. Setting up the environment
  2. Gathering the data (Data collection)
  3. Training the model
  4. Testing the model
  5. Exporting the model to PictoBlox
  6. Creating a script in PictoBlox

Setting up the Environment

First, we need to set the ML environment for image classification.

evive Alert
The Machine Learning Environment for model creation is available in only the desktop version of PictoBlox for Windows, macOS, or Linux. It is not available in Web, Android and iOS versions.

Follow the steps below:

  1. Open PictoBlox and create a new file.
  2. Select the coding environment as Python Coding.
  3. To access the ML Environment, select the “Open ML Environment” option under the “File” tab.

  4. You have to download the Python Dependencies when you execute it the first time. The following window will open. Click on the Download button and wait for the dependencies to download.
  5. You’ll be greeted with the following screen.
    Click on “Create New Project“.
  6. A window will open. Type in a project name of your choice and select the “Image Classifier” extension. Click the “Create Project” button to open the Image Classifier window.
  7. You shall see the Image Classifier Workflow with two classes already made for you. Your environment is all set. Now it’s time to upload the data.

Collecting and Uploading the Data

Each class is a specific category. The Machine Learning model classifies the images into such two or more classes. Similar images are put in the same class.

There are 2 things that you need to provide in each class:

  1. Class Name: Write a name at the place “class1” is written, by clicking on the pencil icon.
  2. Image Data: This data can either be taken from the webcam (Webcam button) or by uploading (Upload button) from local storage or from google drive.

For this project, we’ll be needing three classes:

  1. Wearing mask – Mask On
  2. Not wearing a mask – Mask Off
  3. Wearing mask incorrectly – Mask Wrong

Follow below given steps, to upload the data for the three classes:

  1. Rename the first class: Mask On.
  2. Click the Webcam button.
    If you want to change your camera feed, you can do it from the webcam selector in the top right corner.
  3. Next, click on the “Hold to Record” button to capture the with mask images. Take 200 photos with different head orientations.If you want to delete any image, then hover over the image and click on the delete button.Once uploaded, you will be able to see the images in the class.
  4. Rename Class 2 as Mask Off and take the samples from the webcam.
  5. Click the “Add Class” button, and you shall see a new class in your Environment. Rename the class name to Mask Wrong.

    Note: You must add at least 20 samples to each of your classes for your model to train. More samples will lead to better results.
  6. As you can see, now each class has some data to derive patterns from. In order to extract and use these patterns, we must train our model.