Face Mask Detection Using LabView 1

—Rapid worldwide spread of Corona virus Disease 2019 (COVID 19) has resulted in a global pandemic. In present scenario due to covid-19, the mask has been an important part of our live for our safety as well as for the others safety so there is a need for efficient face mask detection applications in crowded areas like shopping malls, public transportation etc. To ensure safety of the people in the surroundings. Face Mask Detection using NI LabVIEW. In this project a real-time system is developed to detect whether the person is wearing a mask or not by acquiring a real-time image of him through a Camera. The main challenges in detecting the mask are there are masks with various colours and patterns and secondly the background, light intensity are also the factors that affect the result. So, all these factors should be taken into consideration while developing the system in real-time. This system used for this application consists of vision development module. Vision development module helps to develop applications for machine vision and image processing applications we can use it with LabVIEW for real-time systems. A camera with good pixel quality is used for image acquisition. The captured image is of RGB format, it is difficult to analyse the image in this format, so it undergoes colour plane extraction in this only a single plane of the image is considered which separates the mask from surroundings and results in a grey scale image for further processing. The image later is compared to a custom-made template dataset using pattern matching algorithm from vision assistant which helps to detect the mask region. overlaying techniques are used to highlight the mask region which shows that the person is wearing the mask.


Introduction
The world is fighting with Covid-19 pandemic.There are many essential equipment's needed to fight against Corona virus.One of such most essential is Face Mask.Firstly, face mask was not mandatory for everyone but as the day progresses scientist and Doctors have recommended everyone to wear face mask to prevent further spreading of the disease.Now it has become mandatory to use the mask at all time in the public place for the safety of one's own and the others in that surrounding.Some people neglect this instruction which affects the people around them and leads to further spreading of the disease, so it is important to detect whether a person is using a face mask or not.We will use Face Mask Detection technique to verify or check whether a person is wearing Face Mask or not.
There are numerous methods that can be used in detecting the face mask.They categorized into four types which are feature-based, knowledge-based, image-based, and template-based matching method.The knowledge-based method [1] depends on the set of rules, and it is based on knowledge to detect the faces.A face must and should have a nose, eyes, and mouth within certain distances and positions with each other this cannot be used for images with complex backgrounds.The Feature-based type requires information like skin colour, edge information and motion [2].The methods based on this type are not affected by luminous conditions and orientation, but the mask hides the facial features, so it is not feasible.Image based method [3][4] have predefined algorithms which help to train like neural networks by taking many samples.Template-based methods [5] uses the algorithm called correlation to match patterns between the input image and the templates.This method is suitable by creating templates of various masks and using it as a dataset.The main challenges in detecting the mask are there are masks with various colours and patterns and secondly the background, light intensity are also the factors that affect the result.So, all these factors should be taken into consideration while developing the system in real-time.By taking all the factors into consideration a real time system is designed and developed in LabVIEW environment.The image acquired from real-time undergoes colour plane extraction [6] for further processing.
The primary objective of this work is to identify the presence of a face mask in real-time feed.This system is designed in a way where it can identify the face masks of different colours and patterns at a variation of distances, inclination and with varying of luminous conditions.Face mask detection has several applications in various fields of which many includes the applications which are specific to covid-19.The Face Mask Detection System can be utilized at Hospitals, Airports, Offices, Educational Institutions.

Literature Survey
There are some works related to detecting the face from real-time feed or through images using various techniques and algorithms over the time.All of them are based on 4 ways of detecting the mask.Using knowledge [1] or features [2] or machine vision [3][4] or matching the pattern [5] based approaches all these are helpful to either detect the face from an image or identifying the face from the image.But the system we are implementing in this paper is a step further from all the existing system.We are trying to identify a particular object in the facial region of the real-time image.The methods mentioned in [6] are useful for colour plane extraction and methods in [7] to point of the face region from the complex backgrounds of the image fed into system but this is not useful in the present case as most of the facial features are masked/covered due to the mask which results in abnormalities for further processing of the real-time image [8][9][10].

Methodology
Methods for detecting if the person is wearing a face mask in real-time is discussed in this section.Research was done on designing a face mask detection system in LabVIEW where the system can detect the face mask from the image when run in real-time.The flow architecture of the face mask detection system is shown in the figure 1.

Vision acquisition
In LabVIEW, an image can be acquired in various methods like a sequence of images or image at a particular time frame or the real time image and so on etc.Though there are n number of ways in this a real time image is acquired.There are 2 ways to acquire a real-time image, one the traditional method usage of low-level VI, two the modern method usage of high-level VI.
Low level VI'S: Using the Low-Level VI's, one has more control over allocating and releasing I/O channels.It helps in avoiding unnecessary allocation of channels which in turn saves power and programming memory but every time when there is a need to use a I/O there should a channel to allocate manually and then make use of that particular I/O.
Express level VI'S or High-level VI'S: Using the express VI's to configure the settings for the I/O channels.One can configure them at ease when you place an express VI on the block diagram or double click an express VI a configuration dialog box appears.Use this configuration dialog box to configure the express VI.One can also configure the express VI by wiring values to the terminals of the express VI on the block diagram, but they must remember that they select all, or needed controls to modify the values.
In this work, the High-Level VI's are used.Benefits of using a high level VI is that their interactive configurability.Express VI's are used when the user wants to build their VI or library of VI's for applications easily with minimal programming experience.Though configurability of express VI's provides an interactive way to determine settings for operations such that the user could expect some difficulty in fully understanding the features.A good advantage of express VI's is that they function independently i.e., the separate instances of the express VI's.When an express VI is placed in the block diagram, an instance is embedded in the block diagram.The settings of the express VI does not other express VI's.Some of the Express VI's are shown in figure 2.

Colour plane extraction
The image acquired in real-time by using Vision Acquisition is extracted into a single-color plane.The 3 main planes are Red, Green, Blue planes.The plane is selected based on how good the mask is being highlighted from the image to differentiate it easier with respect to the background and the resulting image after plane extraction is used for the later process like pattern matching, edge detection etc.
The colour plane extraction for a single image in RED, BLUE, GREEN plane is as shown respectively for figure 3

Template creation
This step comprises of comparing our real-time image with a template which basically is a database of masks which were created by this process.
This process plays a crucial role for detecting mask when there are some unnecessary marks or designs on the mask as the regions to ignore in the mask will be selected in this process.
The Vision Assistant is used as the process such as colour plane extraction and template matching are completed inside the Vision Assistant and to select the regions to ignore in this process.First, take an image of person wearing a normal mask then, use colour plane extraction and extract a single colour of the image.
Using Pattern Matching, crop the area of the mask and see the regions such as ear or any other are minimized during the process of cropping.Then after this select all the regions to ignore by a pencil tool and mark those areas, then after this process give the angle 180º, so the mask is to found even if the mask is reversed in the image up to an angle between 0º -180º.Now, save the template in some location feasible and save it with an appropriate name.

Template matching
The template matching from machine vision in Vision Assistant then the template is loaded which was already created then the specifications are chosen if there is a need of overlapping objects or low contrast or large template according to the need of the individual and go to options and in general parameters, the information regarding the Algorithm used and Minimum Match Score can be seen in the parameters list.
The Match Score is set to an average value such that even if the mask is disoriented in the image or any other kind of masks are also detected via with this template.One can change the settings up to pixel level if they select parameters from general to advance though it makes understandable to the user.This is going to be the template file which can be used for multiple masks, but it might not detect under conditions if the image is extracted in another plane compared to the mask.

Overlaying
Image overlaying is the process of overlaying text, lines, shapes, image, or bitmap onto an existing image or in real-time.The system uses bounding box from Vision Assistant which basically provides the coordinates of the mask on the real-time image and in addition the system makes use of 3 types of image overlays namely Overlay Oval, Overlay Lines, Overlay Multiple Lines.After pattern matching from vision assistant, the system will be getting matches, in matches this is a cluster which gives position and bounding box, these are being used for overlaying by using these the overlay is implemented such that, when a mask is detected in the image from realtime these geometrical shapes are overlayed on the mask which helps us to identify the mask.

Results and Discussion
After following the procedures in an order with a keen intent, and it achieved a satisfactory performance.To see the functionality of the proposed method in LabVIEW, the VI is run in conditions such as different distances, angle, positions, and orientation.To get more and better accurate results there is a need to give more masks for database, and it needs to be remembered that the masks are to be made as templates in the procedure given above and then only, the results can be achieve as expected.As you can see the results in the figures following.As you can see in figure 4(a) shows that there is no mask and in figure 4(b) mask being detected with a match score of 530 and minimum number of findings to be kept to 1(As only one person is occupying the camera at that instinct of time).In figure 5 the orientation of mask is being changed and the mask is being detected though only part of the mask is being seen.In figure 6 the mask is being detected even if the lighting conditions vary up to a minimum extinct with a match score of 400.In figure 7 the mask is being detected for different kinds of masks.In figure 8 the mask is being detected even if the camera is rotated by keeping the match score of 400.
Though the mask is found there are some exceptional cases where finding the mask becomes harsh.Some of the Exceptional cases are a.If the light conditions are not so feasible i.e., If they are too dark or too light when the image is extracted into different colour.b.If the database of the masks is not updated with the new type of masks with different designs on the mask.c.If the pixel quality of both template and the image in real-time is varying.d.If the match score is too high, it would only find the mask which are same as the template.
Though one can use Low-level VI, the implemented system uses Express VI's.Using Express VI's would make the application run slow but as it would be possessing some high functionalities such as "Regions to Ignore" and other blocks if needed based on the requirements and conditions.

Conclusion
This project describes a real-time face mask detection which was completely developed in LabVIEW platform with the aid of Vision assistant module.The proposed system used techniques like colour plane extraction, pattern matching, to detect the mask region of the input real-time image.The system works well in different backgrounds and masks with different colour and patterns on them.The face mask can be detected from the real-time image of the person even though the person is at different distances from the source(camera).The system is given with a 180degree rotation value so that the mask can be detected even if it is disoriented in the image and other properties like overlapping images, low contrast is taken care and the system detects the mask accurately.A minute change in the background lighting or mask colour does not change its detection rate.As proposed, Pattern matching works for a real-time image even if the image has a complex background.The present system can be used in big malls, Hospitals, Traffic police department at the traffic signals to detect the person who are not wearing the mask and generate a challan which can be used to make them pay for the fine.