Lesson 1, Topic 1
In Progress

Image Classifier

Let us see how to import a model in PictoBlox.

Importing the Model

  1. Open PictoBlox and start a new project.
  2. Select evive as your board from the Board Tab on the menu bar.
    Choose board
  3. Click the Add Extension button and select the Machine Learning extension.
    Machine Learning
  4. Click the Load Model button.
    Load Model Button
  5. A model will open. Paste the link and click the Upload button.
    Load Model
  6. The relevant blocks will appear in the palette when the model is loaded successfully.

Understanding the Machine Learning Blocks

1. open recognition window

opne recognition window

The Open recognition window block opens the recognition window with the camera feed the same as the AI extension and shows the predicted class based on the camera feed.


2. () block


The () block reports the label of the selected class.

3. identify class from ()

get class

The identify class from () block reports the identified class from the selected feed – web camera, stage, or costume.

4. is identified class from () is ()?

is identified class

The is identified class from () is () block reports true if the detected class from the selected feed is the selected class, else false.

5. get confidence of class () from ()

get confidence

The get confidence of class () from () block reports the confidence of the selected class from the selected feed.

evive Notes Icon
Note: Confidence is the likelihood/probability with which the computer a particular object. E.g., if the confidence score of an object identified as an apple is 0.95, it means that the probability that the identified object is an apple is 95%. In other words, the computer is 95% confident that the identified object is an apple (who knew even computers could face uncertainty!).

Tobi – The Classifier

Tobi will do us the honor of telling the result of the classification. Let us write the script for the same: 

  1. Add the test images to the project by clicking the Upload Backdrop button. Select all 10 test images.
    Upload Backdrop
  2. Once uploaded, click the Backdrop tab and delete the white backdrop.
    Delete Backdrop
  3. Select Tobi. Switch to sound tab and add the following two sounds from the library:
    Choose Sound

    1. Meow for cat
    2. Dog2 for dog
  4. Switch back to the Code tab.
  5. Add the when flag clicked block and the forever block into the scripting area and snap them together.
    Cat vs Dog 1
  6. Drag and drop the switch backdrop to () block inside forever block. From the drop-down, select random backdrop.
  7. Drag and drop the say () for () seconds block into the scripting area. In the first space, add the identify class from () block from the Machine Learning extension.
  8. Choose backdrop as the feed from the drop-down.
  9. Drag and drop the if block below the say block. Then, add the is identified class from () is ()? block in condition space. Select backdrop as the feed.
  10. From the Sound palette, add a play sound () until done block inside if block. From the drop-down, select Meow.

  11. Duplicate the if block and snap it below the first if block. Select the class as a dog in the second is identified class from () is () ? block.
  12. Change the sound in the second play sound () until done block to dog2.

Below is the complete script:

Click the green flag to run the script.

Yay! You have made your first Machine Learning project!

evive Explore
Explore: Download more images from the Internet, upload them, and test your model.


Before you move on to the next lesson, a small assignment awaits you!

You must upload the PictoBlox program you wrote in this activity to the website. 

Submitting the assignment is a must to receive the certificate after completing the course.

Follow the steps below to upload your assignment:

  1. Click Choose File.
  2. Select the image from the pop-up window that opens up.
  3. Once the image is selected, click Upload Assignment.
evive Alert
The file type allowed is SB3 file generated from the PictoBlox program. The maximum file size allowed is 15 MB.

Good luck!

Get in Touch!