In this project I am making my own Mask-RCNN model for detecting the mask on people face that He/She wears the masks or not. As we all know in this pandemic situation this is very important to wear the mask for our safety as well as others safety also.
Here my project starts but first I would like to explain you something on Mask-RCNN..
What is Mask-RCNN?
Mask RCNN is a deep neural network aimed to solve instance segmentation problem in machine learning or computer vision. In other words, it can separate different objects in a image or a video. You give it a image, it gives you the object bounding boxes, classes and masks.
There are two stages of Mask RCNN-
- It generates proposals about the regions where there might be an object based on the input image.
- It predicts the class of the object, refines the bounding box and generates a mask in pixel level of the object based on the first stage proposal.
FPN (Feature Pyramid Network):-
Feature pyramids are a basic component in recognition systems for detecting objects at different scales. But recent deep learning object detectors have avoided pyramid representations, in part because they are compute and memory intensive. In this paper, we exploit the inherent multi-scale, pyramidal hierarchy of deep convolutional networks to construct feature pyramids with marginal extra cost.
RPN (Region Proposal Network):-
A light weight neural network called RPN scans all FPN top-bottom pathway( hereinafter referred to feature map) and proposes regions which may contain objects. That’s all it is. While scaning feature map is an efficient way, we need a method to bind features to its raw image location.
Prerequisites for making this model:-
- Account on Supervisely.
- Download your dataset for training the model. As I downloaded from kaggle.
- Account on AWS and know how to use it.
Supervisely is a powerful platform for computer vision development, where individual researchers and large teams can annotate and experiment with datasets and neural networks.
With Supervisely you can:-
- Label images, videos, 3D point clouds, volumetric slices and other data in the best labeling tool.
- Manage and track annotation workflow at scale with teams, workspaces, roles and labeling jobs.
- Train and apply Neural Networks on your data — from our Model Zoo or your custom ones.
- Explore your data and automate common tasks with integrated Python Notebooks and Scripts.
Now Here I started for creating the model.
First Login into your account in supervisely.
Then choose where you want to work-
Now import your dataset in supervisely.
Then go to your projects and you will that your dataset is their.
Here click on the option and click on Start annotation.
click on the image dataset uploaded and then you have to annotate or select the region where we can see mask in the image. We need to do this for all images. This is called annotation of image through which the model will come to know which object we need to detect. For this we will use polygon object selector.
Now after completing this click on the option and choose Run DTL and another option choose From Scratch.
Then go to clusters and you have to create your own cluster.
So it require a agent with Linux OS, Docker, CUDA GPU and NVIDIA Docker GPU. It also gives us the command to run on the agent machine so that it can connect.
Now to get those resources we can use AWS Cloud, even you see it gives an option of Ready AMI with AWS symbol. If you click it it will give all the specification to host the agent on AWS cloud but I will show a different way to do this on AWS itself.
First of all create a AWS account of free type. Then follow the steps below.
Make the region to be Mumbai.
Now, Wait for the confirmation mail regarding this case.
After you got the mail then start launching the Instance as I do.
Choose this ami.
Now, select your keys.
Now click on launch and go to Ec2 instance and you will see your instance is launched.
Now click on connect.
Open the CMD and navigate to downloads because there we have downloaded the key and run the command given in this pop up, you just have to run the ssh command nothing else.
Choose the option “yes”
Here you go inside the instance and go to root permission.
Now, run the command that is shown in supervisely cluster.
After that you will see that it starts.
Now go to supervisely and go to Neural networks tab and select Mask-RCNN and then press train.This will train the model and finally it will create the model.
The whole workflow of machine learning training will be:-
This model help the government to find the person without mask in this pandemic situation.