 Hello everyone, welcome to the Pictoblox machine learning environment tutorial series. In this tutorial, we are going to learn about image classification. It is one of the machine learning model types which can be trained in Pictoblox. Image classification is used for classifying images into different classes based on their characteristics. For example, whether the image has a cat or a dog, classifying whether I am wearing a mask or not. In this example, we are going to make a mask detector in Pictoblox in the Python coding environment. Here Pictoblox will identify three conditions. Person wearing a mask, person is not wearing a mask and person is wearing the mask improperly. Let's get started. Open the Pictoblox and select the Python coding environment. Go to the machine learning environment by selecting the open ML environment option under the files tab. As we are training our models in Python, it is important that we have the required dependencies. In order to download these dependencies, simply click on the gear icon on the top right of your screen and select the download dependencies option. This will download and update the dependencies required to train the model. Click on the create new project option to initialize your project. Type an appropriate name for the project and select the image classifier as the model type. Click on the create project button and you will see the image classifier window. When you are greeted with the image classifier window, you will see two classes, class one and class two made for you by default. Let's understand what a class is. A class is basically the category in which the model classifies the images. Like for dog images, you have a different class called dog and for all the cat images are added under the class name cat. Now coming back to the project, edit the first class name to mask on. There are three ways in which you can add data to your project. Using a device webcam to click email samples, using the upload button to upload images from your device and by using the upload classes from fold button to import a dataset. For this example, we will take the image from the camera. Click on the hold to record button to capture the with mask images. You will need at least 20 images to train the class. For this example, you can take 200 photos with different head orientations. If you want to delete any image, hover over it and click on the delete button. Once uploaded, you will be able to see the images in the class. Rename class two as mask off and take the samples from the webcam. Click the add class button and you should see a new class. Rename the class to mask wrong. As a thumb rule, you should try to add an equal number of images in every class. Large variations in data can be a problem by training the model. Training is where the classifier extracts features from the added data and trains a model to recognize the images in the classes. This way, the model will be able to classify unseen images as per the classes provided. Use the advance tab to alter the hyperparameters of a model. In the image classifier, you can play around with epochs, back size and learning rate. Do note that learning rate is an extremely sensitive hyperparameter and can greatly affect the performance of your model. Click to blocks gives you an option to train the image classification in both JavaScript and Python. Just flick the switch on top of the training box to cycle between the two. Training the model might take some time. Keep a check on the accuracy graph while training is done. You can view a comprehensive report of your model performance in the trained report. The trained report consists of the accuracy and loss curve of the model, the confusion matrix of the model, the true positives, false negatives and false positives for each class. Once training is complete, it's time to test our model on alien data. The model trains itself on the images we provide, but a model is only useful if it can classify alien data just as well as it classifies the training data. This is where model testing comes into play. You can test the images here. Much like training, testing can be done either by using a device's webcam or by uploading data from your device. Start the camera and test the model. Click on the export model button on the top right of the texting box and pick two blocks will load your model into the Python coding environment. Observe how we have a boilerplate code already. This code uses cv2 to capture images and displays the class of the image in the frame. Let's run it and see the code in action. Now we need to edit this code to make Toby respond to the classes. Use the sprite function and declare Toby as the sprite for this project. Now we need to add conditional statements to a project. To do this, we will use the if, lf and else statements. The if statement is used to give out our first condition. The lf statement covers the else if conditions and the else statements gives the condition to be followed in case none of the if or lf statements are triggered. Add an if statement with predicted class set to mask on. Use sprite.say under the if statement and write thank you for wearing the mask properly. Add an lf statement with predicted class set to mask off. Use sprite.say under the if statement and write please wear the mask. Add an else statement and in the sprite.say block under it write please wear the mask properly. The script is now complete. Click the run button to run it. There you have it. You just use image classification to make your own mask detection project in python coding.