Original article was published by T.AI on Artificial Intelligence on Medium
Step 1- Get Started:
Please go to Teachable Machine and click on
As you are trying to build mask detection on human faces it is obvious that the model needs Images as training data. So let’s go ahead and select Image Project.
Feed your curiosity — You can try to use pose project and see how the model is performing compared to image project. The steps involved will be basically same, so you can follow the guide here.
Click on Image Project and get set for the next step
Step 2- Generate Training Samples:
The most important thing to build a model is Training data. As promised you don’t have to worry too much about Training data if you are trying to build a model using Teachable.
You can upload data from Local Disk or Google Drive if you have one already or else you can create by yourself using the webcam.
I totally recommend using your webcam for this project as you get to experience the ease of doing it.
You can create as many labels as you want by clicking on Add Class.
For this project, we need two classes
- No Mask
Go ahead and change them by clicking on the class names.
Next, click on Webcam Button and Hold to Record to generate images. Generate about 110 images of each class which should be sufficient enough for this project.
Wear a mask and move your head around so it can recognise images from different directions to generate images for Mask class.
Remove mask and take images for No Mask class.
That’s it you got your training data with labels.
Step 3 — Training Model:
Just click on
Training to start the training of the model.
You can play around with parameters Epochs, Batch Size, Learning rate.
One of the cool features of Teachable is you can see how your model is getting trained by clicking on under the hood.
With default settings and 110 images of each class, the model usually takes less than a minute to get trained.
Step 4 — Check The Results:
Congratulations! For training an awesome and complex Machine Learning model in less than 5 minutes.
Its time to have fun with the model and check how are the results.
You can see from the Model Output Gif, it is producing pretty satisfying results for both classes.
Model is able to identify Mask on my face and when I place the mask on my forehead it identifies as No-Mask as expected.
You can now export the model and use it out of Teachable platform if you need.
If the hi-fi words like Artificial Intelligence, Machine Learning, Advanced Statistics scares you? Don’t worry all you have to do is to start small and pick projects like this as they have the power to ignite the spark, give you that adrenaline to keep you going forward to reach your final goal.
Give it a try and let me know if you made any interesting projects out of it.