Face Mask Assistant: Detection of Face Mask Service Stage Based on Mobile Phone

Yuzhen Chen, Menghan Hu, Chunjun Hua, Guangtao Zhai, Jian Zhang, Qingli Li, Simon X. Yang

TL;DR

Researchers have developed a mobile-based "Face Mask Assistant" that uses a clip-on microscope and machine learning to determine if a surgical mask is still safe to wear. By analyzing micro-scale texture changes and debris accumulation, the system achieves over 82% precision in classifying a mask's current service stage.

What Problem Does This Paper Address?

During the COVID-19 pandemic, surgical masks became a daily necessity. However, mask shortages and the nature of "short-time, high-frequency" use—where a person might wear a mask for just a few minutes multiple times a day—created a dilemma: when should a mask actually be discarded?

While health organizations provide general guidelines, the actual degradation of a mask depends on individual use intensity and environmental conditions. There is currently no objective, easy-to-use way for a layperson to tell if their mask’s filtration efficiency has dropped or if its respiratory resistance has increased due to trapped particles and moisture. This paper aims to bridge that gap with a portable, low-cost solution.

Methods

The authors propose a system combining specialized hardware with a standard machine-learning pipeline:

  1. Hardware: A "TIPSCOPE" mobile microscope (capable of up to 400x magnification) is attached to a smartphone camera. The phone's flash is kept "on" to provide consistent illumination for micro-photography. Hardware setup including the mobile microscope and smartphone
  2. Feature Extraction: The system uses Gray Level Co-occurrence Matrix (GLCM) analysis. This is a statistical method that characterizes texture by calculating how often pairs of pixels with specific values and in a specified spatial relationship occur in an image. The researchers extracted four specific metrics: contrast, correlation, energy, and homogeneity.
  3. Classification: A K-Nearest Neighbor (KNN) algorithm was chosen for its simplicity and ease of deployment on mobile devices. The algorithm compares the texture features of a new "test" photo against a labeled training set to find the most similar matches. Flowchart of the KNN classification process
  4. Deployment: The entire system was integrated into a WeChat Applet, allowing users to upload micro-photos and receive a service stage assessment from a back-end server.
Fig. 1. The overview of the portable detection device’s “Hard- ware”. The “Hardware” is composed of a mobile microscope, a phone with available system camera, etc. Specifically, a) and b) represent the mobile microscope and system camera, respectively; and c) shows the final removable device mainly assembled by a) and b).
Fig. 4. The flowchart of KNN algorithm. First, labels are attached to the training samples. For every test sample, the distancei is calculated between the test sample and the training samples in each label, which follows the equation 5. By comparing the distances, the test sample’s nearest neighbors viz.the minimum distance are obtained, and serial number imin is then produced. Eventually, the final classification is set as label imin.

Datasets

The researchers collected a custom dataset of 87 micro-images of surgical masks.

  • Sampling: To ensure validity, they photographed three specific locations on the inside of each mask: left, middle, and right. Sampling locations on the face mask
  • Conditions: The masks were worn by three different people during various daily activities, such as running, talking, and shopping.
  • Labels: Data was categorized into three service stages:
  • Type I (Normal Use): Day 0 to 1.
  • Type II (Early Warning): Day 2 to 3.
  • Type III (Not Recommended): Day 4 to 5.
Fig. 3. The three inside photographed locations of the face mask: left location (about one-third of the face mask and close to the left), middle location (about two-thirds of face mask), right (about one-third of the face mask and close to the right).

Key Insights and Ideas

  • Micro-scale is Mandatory: A critical finding was that standard smartphone photos are insufficient. While a regular photo might show a large stain, it cannot capture the micro-debris, droplets, and fiber wear that indicate a mask's true condition. The microscope is "indispensable" for this application.
  • Predictable Texture Trends: The study found that as masks age, their contrast and correlation increase, while energy and homogeneity decrease. This is likely due to the accumulation of impurities and the physical breakdown of the mask's micro-structure over time.
  • Optimal Hyperparameters: Through experimentation, the team found that a $K$ value of 6 was optimal for their KNN model, aligning with theoretical predictions for their sample size ($k \approx \sqrt{n}$).

Key Results

The system demonstrated strong performance in distinguishing between the three stages of mask wear:

  • Precision: The three-category model achieved a macro-precision of 82.87% (±8.50%).
  • Confusion Matrix: The model was particularly effective at identifying "Type III" (not recommended) masks, correctly flagging 25 out of 27 samples. Confusion matrix showing classification accuracy across the three types
  • Simplified Model: When the researchers simplified the task into a binary "Normal Use" vs. "Not Recommended" model, the accuracy increased to 88.51%.
Fig. 6. The confusion matrix of the classified results. Each row is the number of real labels and each column is the num- ber of classified labels. Type I, Type II and Type III repre- sent ‘normal use’, ‘early warning’ and ‘not recommended’, respectively.

Limitations and Future Work

While promising, the study notes several limitations:

  • Scope of Objects: The current model is trained specifically on surgical masks. Different materials (like N95 or cloth masks) would likely require different feature sets or training data.
  • Environmental Factors: The system cannot currently account for masks that get wet or have internal linting, both of which necessitate immediate disposal regardless of the "service stage."
  • Algorithm Stability: The authors plan to explore more stable algorithms in the future to further improve accuracy and expand the types of masks the system can reliably detect.

Summary updated

Abstract

Coronavirus Disease 2019 (COVID-19) has spread all over the world since it broke out massively in December 2019, which has caused a large loss to the whole world. Both the confirmed cases and death cases have reached a relatively frightening number. Syndrome coronaviruses 2 (SARS-CoV-2), the cause of COVID-19, can be transmitted by small respiratory droplets. To curb its spread at the source, wearing masks is a convenient and effective measure. In most cases, people use face masks in a high-frequent but short-time way. Aimed at solving the problem that we don't know which service stage of the mask belongs to, we propose a detection system based on the mobile phone. We first extract four features from the GLCMs of the face mask's micro-photos. Next, a three-result detection system is accomplished by using KNN algorithm. The results of validation experiments show that our system can reach a precision of 82.87% (standard deviation=8.5%) on the testing dataset. In future work, we plan to expand the detection objects to more mask types. This work demonstrates that the proposed mobile microscope system can be used as an assistant for face mask being used, which may play a positive role in fighting against COVID-19.
BibTeX
@misc{chen2020face,
  author = {Yuzhen Chen and Menghan Hu and Chunjun Hua and Guangtao Zhai and Jian Zhang and Qingli Li and Simon X. Yang},
  title = {{Face Mask Assistant: Detection of Face Mask Service Stage Based on Mobile Phone}},
  year = {2020},
  eprint = {2010.06421},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2010.06421},
}
Figure