Abstract
Background
Current mask-wearing monitoring technologies face bottlenecks in complex scenarios, including high false-negative rates for small targets, ambiguous discrimination under dense occlusion, and poor recognition of “improper wearing.” This study proposes an efficient, robust detection model to enhance supervision and infection control in densely populated areas like hospital lobbies and subway gates.
Method
A YOLOv11-Star-TripletAttention detection framework was constructed for medical and public health scenarios. Firstly, a lightweight C3k2_Star module was integrated into the backbone to enhance multi-scale feature interaction via Star topology, reducing computational costs while improving sensitivity to distant small faces and mask edges. Secondly, a Triplet Attention mechanism was embedded in the detection head to jointly model channel, height, and width dimensions. This strengthens semantic responses in mouth-nose regions, accurately evaluating coverage integrity and alleviating ambiguity from posture changes, occlusion, and background interference. Experiments were conducted on a self-built multi-scenario dataset covering high-risk areas.
Results
The experimental results demonstrate that the proposed YOLO11-Star-triple significantly outperforms the baseline YOLO11, achieving a Recall of 0.761 (a 30.0% improvement) and an F1-score of 0.856 (a 17.6% improvement), with an mAP50 of 0.796. Furthermore, the model maintains real-time inference speeds (> 30 FPS) while exhibiting superior robustness in challenging medical scenarios, such as dense crowds in waiting areas, low-light environments, motion blur, and severe occlusion. These capabilities enable the effective identification of high-risk behaviors, specifically the “incorrect wearing” of masks, which are often missed by standard detectors.
Conclusion
The proposed YOLO11-Star-TripletAttention model effectively addresses the technical challenges of mask-wearing state recognition in complex real-world scenarios, successfully balancing detection accuracy, inference efficiency, and environmental robustness. Mechanism analysis reveals that the C3k2_Star module significantly enhances small target detection, while the Triplet Attention mechanism strengthens the discrimination of intermediate states (e.g., incorrect wearing). Consequently, this study provides an efficient, reliable, and deployable digital solution for personnel flow management in smart hospitals, precise infection prevention and control, and occupational health monitoring, demonstrating significant clinical application prospects.
Keywords: Mask wearing detection, YOLOv11, Star-shaped module, Triple attention mechanism, Digital prevention and control
Introduction
Highly contagious respiratory pathogens, including influenza, SARS, and COVID-19, spread primarily via droplets [1, 2], posing persistent threats to global health through their high infectivity and potential for large-scale outbreaks. Beyond public health, high-risk occupational settings (e.g., construction, manufacturing, mines, operating rooms) expose workers to concentrated dust, smoke, diesel exhaust, and chemicals, significantly elevating risks of lung cancer, COPD, and asthma [3–5]. Extensive studies confirm that scientific mask-wearing effectively blocks pathogen transmission [6, 7] and prevents occupational diseases [8], standing as a cost-effective Non-Pharmaceutical Intervention (NPI) [9, 10]. Consequently, enforcing and monitoring proper mask compliance has become a cornerstone of infection control and occupational safety management.
However, in practical applications, due to weak individual protection awareness, operational negligence, or the absence of regulatory mechanisms, the phenomenon of not wearing or wearing improperly (such as only covering the mouth, pulling the mask down to the chin, exposing the nose, etc.) is widespread. Such behaviors not only weaken the protective effect [11, 12], exacerbate infection and occupational disease risks, but also impose additional burdens on the public health emergency response system. Traditional manual inspection is inherently inefficient, subjective, and incapable of continuous, wide-area real-time monitoring. Consequently, computer vision-based intelligent recognition has emerged as a pivotal bridge between AI and health safety management. In recent years, research has heavily focused on lightweight architectures to enable deployment on edge devices. For instance, scholars have proposed a lightweight network without anchor points for vehicle detection [13] and a lightweight semantic feature extraction model with direction perception capability for aviation traffic target detection [14]. These advancements suggest that lightweight networks can effectively balance efficiency and accuracy in real-time applications.
To further promote the practical application of target detection under specific conditions, researchers have conducted extensive academic exploration: Guo et al. [15] developed LLMD for low-light scenarios, while Ge et al. [16] achieved 76.4% AP using a cascaded LLE-CNN architecture. Faster R-CNN was employed by Jiang et al. [17] for small targets but suffered from high computational complexity, whereas Xiong et al. [18] reached 87.54% AP via an EfficientNet-based bidirectional fusion model. Recently, YOLO-based single-stage detectors have become mainstream due to their efficiency. Su et al. [19] optimized YOLOv3 with EfficientNet and CIoU loss; Guo et al. [20] enhanced YOLOv5 with Coordinate Attention and BiFPN; knowledge distillation was applied by Liu et al. [21] for lightweight deployment; Gao et al. [22] integrated ResNet for stability; and Wang et al. [23] proposed DTPM-YOLO for dynamic video detection, boosting accuracy by 8.44%. Furthermore, the rapid evolution of neural network architectures has significantly improved the accuracy of medical image segmentation [24, 25].
Despite these optimizations, state-of-the-art YOLO variants still exhibit critical limitations in complex real-world scenarios. First, the detection of small targets is hindered by the ‘semantic gap’ in the feature pyramid; shallow layers lack strong semantic information, while deep layers suffer from low spatial resolution. Second, occlusion poses a significant challenge as the Non-Maximum Suppression (NMS) process in YOLO often suppresses valid predictions of occluded faces due to low confidence scores or overlapping issues. These limitations result in a high false-negative rate in crowded or distant surveillance scenes.
To address these challenges, we propose YOLOv11-Star-TripletAttention, an enhanced detector tailored for public health and industrial safety. Building on YOLOv11, our model integrates a lightweight Star topology to boost multi-scale feature interaction for small targets, and embeds Triplet Attention to jointly model channel-spatial dependencies, explicitly strengthening responses in critical mouth-nose regions to mitigate occlusion and pose ambiguity. Extensive experiments on a self-built multi-scenario dataset (covering subways, hospitals, and waiting areas) demonstrate that our method achieves real-time inference (> 30 FPS) while significantly outperforming mainstream approaches in mAP50, Recall, and F1-score. Notably, the model exhibits superior robustness in complex conditions—including severe occlusion, low light, and small targets—providing reliable technical support for intelligent epidemic prevention and occupational health monitoring.
YOLOv11-Star-TripletAttention algorithm
General introduction of YOLO11-Star-TripletAttention
The general architecture of the YOLO series models typically consists of three core components: the backbone network (Backbone) for extracting low-level features, the neck network (Neck) for achieving multi-scale feature fusion, and the detection head (Head) responsible for target localization and classification. Figure 1 shows the overall architecture of the YOLOv11-Star-TripletAttention model proposed in this paper. In the mask-wearing status recognition task, the face size varies greatly, and the discriminative power highly depends on local details (such as whether the mouth and nose area is effectively covered), which poses a severe challenge for the backbone network to efficiently capture high discriminative multi-scale features within a limited computational budget.
Fig. 1.
Network structure diagram of YOLOv11-Star-TripletAttention module
To address this challenge, this paper builds upon YOLOv11n and reconfigures its backbone network into a series of lightweight but highly expressive C3k2_Star modules. C3k2_Star is a structural improvement on the standard C3k2 module, with its core innovation being the substitution of the traditional bottleneck unit with a Star Block and the integration of depthwise convolution and channel rearrangement mechanisms. This design significantly reduces the number of parameters and computational complexity while effectively retaining rich local textures and edge information - which is crucial for accurately capturing key discriminative cues such as mask boundaries and facial contours. Additionally, C3k2_Star supports flexible configuration of residual connection paths and channel compression ratios: in the shallow layers of the network (such as the P3/P4 stages), it adopts a lightweight mode to maintain high-resolution spatial details; while in the deeper layers (such as the P5 stage), it enables a complete residual path to enhance the high-level semantic abstraction ability, thereby achieving adaptive feature modeling for different scale face regions.
In the Neck architecture, high-level semantic features and low-level spatial details are bidirectionally fused via upsampling and concatenation to construct a multi-scale feature pyramid. However, naive concatenation often fails to account for the inherent semantic discrepancies across different scales, potentially diluting critical information with redundant background noise. To mitigate this limitation, we integrate a Triplet Attention module immediately following the fusion output of each detection branch (P3, P4, and P5) to recalibrate the aggregated feature representations.
This mechanism uniquely models inter-dimensional dependencies by jointly computing attention weights across channel, height, and width dimensions. By capturing cross-dimensional interactions, the module dynamically amplifies feature responses in regions highly correlated with mask-wearing states—specifically the perioral and nasal areas—while simultaneously suppressing irrelevant background clutter and occlusion artifacts. This cross-dimensional attention strategy enables the network to adaptively focus on the most discriminative spatial positions and channel combinations, thereby significantly enhancing the semantic distinctiveness and robustness of the fused features for fine-grained mask status recognition.
As illustrated in Fig. 1, the proposed framework operates through a streamlined three-stage pipeline. Initially, the input image is processed by the backbone network, which leverages the novel C3k2_Star modules to extract robust multi-scale facial features. Subsequently, within the Neck architecture, high-level semantic information and low-level spatial details undergo comprehensive interaction via upsampling, downsampling, and attention-enhanced fusion strategies to bridge the semantic gap across scales. Finally, the refined multi-scale feature maps are fed into parallel detection heads, which simultaneously predict bounding box coordinates and perform ternary classification into three distinct categories: “Correct Mask-Wearing,” “Incorrect Mask-Wearing,” and “No Mask.” This end-to-end architecture achieves highly robust and precise recognition of mask-wearing states in complex real-world scenarios.
Detailed description of the module
C3k2_Star module
The proposed C3k2_Star (as shown in Fig. 2) module improv es upon the baseline YOLO11 architecture by substituting the standard Bottleneck blocks within the C3k2 structure with Star Blocks.
Fig. 2.
Network structure diagram of C3k2_Star module
The standard Bottleneck blocks within the C3k2 structure with Star Blocks. This modification is motivated by recent exploration of efficient visual backbone networks (such as StarNet [26]) and the need to enhance feature expressiveness in complex environments. While the original C3k2 block relies on standard convolutional layers for feature extraction, the Star Block introduces a unique “Scaling and Shifting” paradigm, which mathematically employs element-wise multiplication (Hadamard product) to combine linear and non-linear feature maps (
). This design effectively increases the model’s non-linearity and receptive field without introducing significant computational overhead (FLOPs) or parameter bloat. Consequently, the model can better distinguish subtle features—such as the gap between a face and an improperly worn mask—while strictly adhering to the lightweight requirements for real-time edge inference.
Computational efficiency: By avoiding the dense spatial computations in standard convolution, FLOPs and parameters are significantly reduced. This makes the model more suitable for resource-constrained edge devices (such as embedded monitoring terminals), meeting the real-time and low-power requirements of actual epidemic prevention scenarios.
High-frequency detail retention capability: The Star Block is sensitive to local textures and boundaries, effectively maintaining the high-frequency discriminative features of the mask edge contour, folding structure, and the junction with facial skin. This is crucial for distinguishing fine-grained categories such as “correct wearing” (fully covering the mouth and nose) and “incorrect wearing” (only covering the mouth or hanging on the neck).
. Robustness to small targets: In long-distance or low-resolution surveillance images, the face area often occupies only a small number of pixels. Traditional modules are prone to losing key semantics. However, C3k2_Star, with its efficient channel modeling mechanism, can still extract sufficient discriminative features from the limited pixels, significantly improving the detection recall rate for small-scale faces.
Ablation experiments show that C3k2_Star, while maintaining a lightweight model, significantly enhances the backbone network’s modeling ability for local occlusion, pose changes, and scale diversity, laying a solid foundation for subsequent high-precision classification and positioning.
Triplet Attention Module
To further augment the detection head’s capacity to capture the geometric structural cues intrinsic to mask-wearing states, we strategically integrate the Triplet Attention module prior to the multi-scale detection branches (P3, P4, and P5). The architectural schematic of this module is depicted in Fig. 3. This mechanism operates by constructing attention weights in parallel across three mutually orthogonal subspaces: channel-height (C×H), channel-width (C×W), and spatial plane (H×W). By leveraging dimensional permutation (tensor rotation), the module explicitly models long-range inter-dimensional dependencies, allowing information to flow freely across channel and spatial domains.
Fig. 3.
Network structure diagram of the Triplet Attention module
In contrast to traditional attention mechanisms—such as the SE Block, which focuses exclusively on channel interdependencies, or CBAM, which sequentially aggregates channel and spatial information—Triplet Attention decouples the feature refinement process. It independently captures discriminative cues along the horizontal axis, vertical axis, and global spatial context. This unique capability enables the network to precisely localize critical facial landmarks (e.g., nose bridge, mouth coverage) and robustly handle variations in pose and occlusion, which are critical for distinguishing between correct and incorrect mask usage.
In the task of mask recognition, which highly relies on geometric consistency, this mechanism demonstrates unique value:
Precise assessment of coverage completeness: Attention on the C×W plane can effectively determine whether the mask covers the cheek area horizontally, while the C×H plane focuses on the vertical structure, accurately capturing key indicators such as the nose bridge fit and chin exposure degree, thereby supporting fine-grained discrimination of the “partial coverage” category;
Strong posture adaptability: Facing various face postures such as frontal, side view, and incline, the triple attention mechanism can dynamically adjust the focus area, ensuring that it remains focused on the effective mask-related areas even when the viewing angle changes dramatically, significantly alleviating performance degradation caused by the diversity of postures;
Background interference suppression: Spatial attention in the H×W space effectively suppresses the responses of clothing collars, hair, hands, or other adjacent objects, significantly reducing the false positive rate of mistaking scarves, collars, etc. for masks.
It is worth emphasizing that Triplet Attention does not introduce any additional learnable parameters and only increases FLOPs by less than 1%, yet it brings significant performance improvement in complex real-world scenarios (such as dense crowds, low light conditions, motion blur, or partial occlusion). This characteristic makes it an ideal plug-and-play enhancement module for resource-sensitive applications.
C3k2_Star and Triplet Attention jointly optimize the entire detection pipeline from the two dimensions of backbone feature extraction efficiency and detection head geometric perception ability. The former ensures that the model runs efficiently at the edge and retains key details, while the latter endows the system with the ability to understand the spatial structure of the mask precisely. Together, they constitute the core technical pillar that achieves an excellent balance between accuracy, robustness, and deployment feasibility in this method.
Experimental process and results
Dataset construction
For side profiles or faces with large-angle tilts, the annotation process relies on geometric analysis of keypoint visibility. If the side view allows for clear observation of the separation between the mask edge and the facial contour, such as the exposure of the nasal wing or mouth, the instance is determined as “Incorrect Wearing.” If the viewing angle is too extreme, resulting in the loss of critical judgment basis and making it impossible to determine the actual state of the mask, a conservative strategy is adopted to classify it as “No Mask,” thereby ensuring the purity of the dataset and the robustness of model training.
Building a high-quality and diverse dataset is the prerequisite for developing a robust algorithm for detecting mask-wearing status. To comprehensively cover the complex changes in real scenarios, this study adopts a multi-source data collection strategy, which includes: (1) Open dataset screening: systematically collecting and evaluating multiple publicly available mask-related datasets (such as MAFA, RMFD, MaskedFace-Net, etc.), based on criteria such as image resolution, annotation quality, and scene diversity, to select samples that meet the requirements. (2) Internet image retrieval and screening: conducting targeted crawling on compliant open image platforms (such as Flickr, Google Open Images, Baidu AI Open Platform, etc.) using keywords (“masked face”, “incorrect mask wearing”). All retrieved images underwent a rigorous manual curation process to exclude low-quality, blurred, or copyright-restricted samples.
To ensure the robustness and generalizability of our detection framework, we conducted a granular categorization of facial coverings within the training and testing datasets. The primary focus of our study is the standard 3-ply surgical mask, which represents the most prevalent type recommended by public health authorities for general population use. To evaluate the model’s performance under stricter conditions, we incorporated a secondary category of N95/KN95 respirators, characterized by their tight fit and high filtration efficiency. Furthermore, to account for the variability in material opacity and weaving density commonly found in community settings, a subset of multi-layer cloth masks was included. This stratified approach aligns precisely with diverse precision public health control standards, ensuring our model can accurately distinguish between different levels of facial protection.
Notably, all individuals depicted in the dataset were wearing face masks, which inherently obscured facial features and prevented personal identification. This characteristic ensures strict adherence to ethical guidelines and privacy protection standards regarding human subject data.
From an initial pool of approximately 10,000 raw images, a rigorous annotation protocol was implemented to address complex edge cases prevalent in surveillance contexts. This initial pool was a hybrid collection consisting of roughly 20% web-crawled images (sourced from public event galleries and surveillance footage archives) and 80% open-source datasets (aggregated from standard benchmarks like WIDER and MAFA, but retagged under our specific protocol).
To ensure dataset purity and diversity, we implemented a two-stage deduplication process. First, exact duplicates were removed using MD5 hash matching. For the annotation process, specific guidelines were established to mitigate label ambiguity. If residual structural cues confirmed effective coverage of the mouth and nose, the instance was classified as “Correct Wearing.” Conversely, severe occlusion preventing confirmation of the mask’s integrity or position resulted in a conservative “No Mask” label. From a public health safety perspective, masks completely detached from the respiratory zone (mouth and nose) and resting solely on the chin or neck—defined as “Chin Masks”—were explicitly labeled as “Incorrect Wearing.” This distinction highlights high-risk non-compliant behavior where the mask structure remains intact but fails its protective function. Furthermore, for side profiles or faces with significant angular tilts, annotation was contingent upon the geometric visibility of keypoints. If the separation between the mask edge and facial contour (e.g., exposure of the nasal wing or mouth) was discernible, the instance was labeled “Incorrect Wearing.” In cases of extreme angles where critical judgment criteria were lost, a conservative “No Mask” classification was adopted to ensure model training robustness.
The final constructed dataset contains 9,700 pairs of high-quality image-bound annotation samples, characterized by a comprehensive distribution of mask-wearing states: approximately 4,100 samples of correct wearing (fully covering mouth and nose), 4,700 samples of non-wearing, and 900 samples of incorrect wearing (e.g., exposed nose, chin strap). The dataset exhibits rich contextual variability, encompassing diverse facial expressions, skin tones, demographics, and accessories (e.g., glasses, hats).
Subsequent to collection, images were cropped into 400 × 560 pixel sub-images based on a “mask-center priority” principle, ensuring the mask area occupied ≥ 5% of the frame. Annotations were generated using the LabelImg tool with unified bounding box standards. The dataset was partitioned into training, validation, and test sets in a ratio of roughly 8:1:1 (7,700/1,000/1,000 images). All annotations are stored in JSON format for compatibility with mainstream segmentation frameworks. Figure 4 illustrates representative samples from the dataset.
Fig. 4.

Some samples from the dataset
Test results
To ensure the reproducibility of our research, we have added a dedicated implementation details in revised manuscript. The experiment was conducted under a unified configuration. The hardware used was an NVIDIA GeForce RTX 4080 GPU. The software environment was based on the Windows 10 system and was equipped with Python 3.10, PyTorch 2.3.1 and CUDA 11.8. All experiments were conducted using the Ultralytics YOLO framework. We utilized the SGD optimizer with a momentum of 0.937 and a weight decay of 5 × 10− 4. The model was trained for 1000 epochs with a batch size of 32 and an input image size of 640 × 640. The initial learning rate was set to 0.01. Regarding data augmentation, we employed standard strategies including Mosaic augmentation (disabled in the last 0 epochs as per close_mosaic = 0), MixUp, Random Perspective, HSV color augmentation, and Random Flipping.
Figure 5 presents the typical prediction results of the proposed mask wearing status detection model on the test set, systematically verifying its classification ability and robustness in diverse real-world environments. Each sub-figure contains the original input image, the model’s output bounding box, the category label (along with the corresponding confidence score). The model divides the wearing status into two categories: R_mask (correct wearing, meaning the mask fully covers the mouth and nose), N_mask (not wearing), and W_mask (incorrect wearing, including cases where only the mouth is covered, the nose is exposed, or the mask hangs on the neck, etc.). From the overall performance, the model demonstrates excellent generalization performance under various challenging conditions. Firstly, when faced with different materials and styles of masks (such as surgical masks, cotton masks, colorful printed masks, transparent masks, and masks with decorative patterns or filter structures), the model still maintains high discrimination accuracy, indicating its strong invariance to texture, shape, and color changes. Secondly, in complex lighting conditions - including indoor low light (such as test 389.jpg), outdoor strong light (such as test 842.jpg), backlight (such as test 328.jpg), and high-contrast background (such as the pure color background in test 825.jpg) - the detection boxes can still stably locate the face area and assign the correct category labels, indicating the model’s good lighting invariance and background interference suppression ability; especially noteworthy is that in the same image where there are multiple individuals with different wearing statuses (such as test 421.jpg and test 833.jpg), the model can independently accurately classify each target. The detection boxes closely fit the facial area, indicating the model’s good spatial positioning ability. In conclusion, these qualitative results fully validate the effectiveness, generalization ability, and practical value of the proposed method in actual epidemic prevention monitoring scenarios.
Fig. 5.
Detection results of the test set
Figure 6 presents the evolution trajectory of the loss function and detection performance indicators during the training process of the proposed model, comprehensively reflecting its learning dynamics and optimization stability. The Box Loss, Cls Loss, and DFL Loss in the training and validation stages all show a trend of rapid decline and convergence, and the validation loss is always closely aligned with the training loss, without any obvious signs of overfitting. Among them, the Box Loss and Cls Loss significantly decayed in the first 50 epochs, indicating that the model can efficiently learn spatial positioning and semantic discrimination capabilities; the stable decline of the DFL Loss indicates that the confidence prediction is gradually calibrated, improving the reliability of the detection results.
Fig. 6.
Evolution of the model’s multi-dimensional performance
Meanwhile, the key evaluation metrics - Precision (B), Recall (B), and mAP50 (B) - continued to improve on the validation set and eventually stabilized at a high level: Precision exceeded 0.85, Recall reached approximately 0.83, and mAP50 converged to 0.88. This result indicates that the model not only has high prediction accuracy but also effectively covers positive samples, achieving a good balance between precision and recall. Overall, the stable convergence of losses and the continuous improvement of metrics jointly validate the rationality of the proposed architecture design and the effectiveness of the training strategy, laying a solid foundation for the model’s robust performance in complex scenarios.
Comparison of model detection effectiveness
Figure 7 presents a comparative visualization of detection outcomes between the baseline YOLOv11 and our proposed YOLOv11-Star-TripletAttention framework across complex real-world scenarios. Qualitative analysis reveals that the proposed model significantly outperforms the baseline, particularly in mitigating critical detection errors. Specifically, the enhanced multi-scale feature interaction effectively recovers small-scale and heavily occluded faces, drastically reducing False Negatives (missed detections) in dense crowds.
Fig. 7.
Comparison of detection results of mask wearing status by different models in complex real scenarios: (A) Original YOLO11 model; (B) Improved YOLO11-Star-TripletAttention model
In small targets and long-distance scenarios (as shown in Figure a1 and b1), the original model failed to detect the leftmost smaller-scale pedestrian instance, while YOLOv11-Star-TripletAttention successfully detected this target with a confidence of 0.7. This indicates that the introduced Star structure effectively enhances the multi-scale feature fusion ability and improves sensitivity to low-resolution targets.
Furthermore, in dense crowd scenes with severe occlusion and pose changes (Figure a2/b2 and a4/b4), the original model showed obvious missed detection phenomena (e.g., the middle pedestrian in Figure a4 was undetected). In contrast, the improved model not only achieved a higher recall rate but also generated more accurate and stable detection boxes. By leveraging Triplet Attention to refine spatial-channel dependencies, the model successfully discriminates true mask-wearing states from background clutter, significantly suppressing False Positives. Collectively, these visual results demonstrate a superior balance between sensitivity and specificity.
Statistical analysis and performance metrics
To systematically evaluate the contribution of the proposed modules, we conducted comprehensive ablation experiments and statistical analyses comparing three model variants: the baseline YOLO11, YOLO11-Star, and the complete YOLO11-Star-Triplet. The results are presented in Table 1.
Table 1.
Accuracy parameters of different models
| Model Name | precision | recall | mAP50 | mAP50-95 | F1-score |
|---|---|---|---|---|---|
| YOLO11 | 0.965 | 0.585 | 0.778 | 0.546 | 0.728 |
| YOLO11-Star | 0.953 | 0.615 | 0.790 | 0.553 | 0.748 |
| YOLO11-Star-triple | 0.979 | 0.761 | 0.796 | 0.564 | 0.856 |
| Rt-detrl | 0.832 | 0.761 | 0.770 | 0.484 | 0.795 |
| Hyper-yolo | 0.932 | 0.607 | 0.774 | 0.540 | 0.735 |
From a performance perspective, YOLO11-Star demonstrates improved Recall (from 0.585 to 0.615) and mAP50 (from 0.778 to 0.790) compared to the original YOLO11. Although Precision slightly decreased, the overall F1-score increased from 0.728 to 0.748, indicating that the C3k2_Star module achieves a better precision-recall balance. With the full integration of the Triplet Attention mechanism, the proposed YOLO11-Star-Triplet framework demonstrates comprehensive superiority, attaining a Precision of 0.979, Recall of 0.761, and an F1-score of 0.856.
From a statistical analysis perspective, the comparative evaluation reveals significant improvements. Compared to the baseline YOLO11, the proposed framework achieves a remarkable 17.6% relative improvement in mAP and 17.5% improvement in F1-score. This represents a substantial effect size in object detection tasks, underscoring the efficacy of our architectural innovations. Against state-of-the-art competitors, our model outperforms Hyper-YOLO [27] and RT-DETR [28] by approximately 4.7% and 14.7%, respectively, in the precision. Moreover, our model achieves improvements of 3.2% and 4.5% over the two baselines in the mAP50-95 metric, demonstrating superior robustness across different IoU thresholds.
The statistical superiority validates the hypothesis that the triple orthogonal attention mechanism effectively models the intricate geometric structures of mask-wearing states. By explicitly modeling spatial-channel joint dependencies, the mechanism enables adaptive focus on critical anatomical landmarks while suppressing background clutter. Their strategic integration culminates in an efficient, robust, and lightweight detection architecture specifically tailored for real-time mask-wearing recognition in resource-constrained edge environments.
Conclusion
This paper addresses the issues of high false negative rate, difficulty in distinguishing occlusions, and insufficient recognition of intermediate states in the mask-wearing status identification in current smart hospitals and public health scenarios. It proposes a robust detection method based on the improved YOLOv11 (YOLOv11-Star-TripletAttention). By introducing the C3k2_Star module to optimize the feature extraction path and embedding the Triplet Attention mechanism to enhance the response to key semantics, the model’s detection performance in complex dynamic environments has been significantly improved. The main research conclusions are as follows:
Technological breakthrough: The proposed method outperforms existing SOTA methods in core indicators such as mAP50, recall rate, and F1-score on the self-built multi-scenario medical public health dataset. Especially in handling extreme conditions such as dense flow in waiting areas, low lighting, and severe occlusions, the model demonstrates excellent robustness and effectively solves the problem of identifying “inconsistent wearing”.
Efficiency and deployment: The model maintains high accuracy detection while having an inference speed exceeding 30 FPS, meeting the real-time requirements of video surveillance systems and having the potential for low-cost deployment in edge computing devices or existing hospital security monitoring systems.
Application value: This research not only provides an advanced algorithm model but also offers strong technical support for the refined infection control management of smart hospitals. The system can be widely applied in scenarios such as outpatient pre-screening, isolation ward monitoring, and screening at public transportation hubs, helping medical institutions achieve a digital transformation from “human defense” to “technical defense”, and has significant practical significance for reducing cross-infection risks within hospitals and enhancing the emergency response capabilities for public health emergencies.
Future work will focus on verifying the generalization ability of the model in more diverse medical scenarios (such as operating rooms, ICUs) and public places (such as subway stations, banks, scenic spots), and exploring deep integration with hospital HIS (hospital information system) and IoT devices to build an all-round intelligent infection control ecosystem.
Acknowledgements
Not applicable.
Authors’ contributions
N.Y. constructed the dataset, developed the code, and wrote the initial draft of the manuscript. Q.L. and Y.Y. performed the data analysis. R.H. designed the study and provided software supervision. L.C. revised the manuscript and prepared the figures. All authors reviewed the final manuscript.
Funding
Not applicable.
Data availability
The datasets analysed during the current study are available from the following sources: The original mask segmentation dataset, named “aliyun2610849957”, is publicly available from the Aliyun Tianchi Laboratory (https://tianchi.aliyun.com/dataset/1740). The web-crawled image set described in this study are available from the corresponding author upon reasonable request.
Declarations
Ethics approval and consent to participate
Not applicable.
Consent for publication
Not applicable.
Competing interests
The authors declare no competing interests.
Footnotes
Publisher’s note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Contributor Information
Runyue Hu, Email: runyuehu121@whu.edu.cn.
Liang Chen, Email: chenliang93@whu.edu.cn.
References
- 1.BenElbahri H, Walha R. A real-time deep learning-based facial mask detection system for preventing the transmission of respiratory viruses. Int J Comput Intell Appl. 2024;23(2). 10.1142/S1469026823500372.
- 2.Liu G, Zhang Q. Mask wearing detection algorithm based on improved tiny YOLOv3. Int J Pattern Recognit Artif Intell. 2021;35(7):2155007. [Google Scholar]
- 3.Almberg SK, Friedman SL, Rose SC, et al. Progression of coal workers’ pneumoconiosis absent further exposure. Occup Environ Med. 2020;77:748–51. [DOI] [PubMed] [Google Scholar]
- 4.Islam ASA, Aiello G, Inguanta R et al. Jul., A wearable biosensor for non-invasive real-time monitoring of hydrogen peroxide in exhaled breath for worker’s health in the construction industry, in Proc. 3rd Int. Conf. Electr Comput Commun Mechatronics Eng. (ICECCME), Tenerife, Spain. 2023. pp. 1–6. 10.1109/ICECCME57830.2023.10253248.
- 5.Yokoe T, Kita M, Odaka T, et al. Detection of human coronavirus RNA in surgical smoke generated by surgical devices. J Hosp Infect. 2021;117:89–95. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 6.Cao R, Mo W, Zhang W. MFMDet: Multi-scale face mask detection using improved Cascade R-CNN. J Supercomput. 2023;80:4914–42. [Google Scholar]
- 7.Johanning E, Auger P, Morey PR, et al. Review of health hazards and prevention measures for response and recovery workers and volunteers after natural disasters, flooding, and water damage: Mold and dampness. Environ Health Prev Med. 2014;19:93–9. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 8.Nordby KC, Notø H, Eduard W, et al. Prospective monitoring of exposure and lung function among cement production workers - Is drop out from the study associated with respiratory health at inclusion? Occup Environ Med. 2014;71(Suppl 1):A52. [Google Scholar]
- 9.Palanisamy V, Thirunavukarasu R. Implications of big data analytics in developing healthcare frameworks - A review. J King Saud Univ Comput Inf Sci. 2019;31:403–12. [Google Scholar]
- 10.Chu DK, Akl EA, Duda S, et al. Physical distancing, face masks, and eye protection to prevent person-to-person transmission of SARS-CoV-2 and COVID-19: A systematic review and meta-analysis. Lancet. 2020;395:1973–87. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 11.Azis FA, Suhaimi H, Abas PE. COVID-19 medical face mask classification using convolutional neural networks to detect proper and improper wearing of face mask. AIP Conf Proc. 2023;2584:030001. [Google Scholar]
- 12.Yang B, Hossain MZ, Rahman S. SS-Faster-RCNN: A domain adaptation-based method to detect whether people wear masks correctly. Proc Int Joint Conf Neural Netw (IJCNN). 2023:1–8. 10.1109/ijcnn54540.2023.10191466.
- 13.Shen J, Zhou W, Liu N, et al. An Anchor-Free Lightweight Deep Convolutional Network for Vehicle Detection in Aerial Images. IEEE Trans Intell Transp Syst 2022;23(12):24330–42. 10.1109/TITS.2022.3203715. [Google Scholar]
- 14.Shen J, Liu N, Sun H, et al. Lightweight semantic feature extraction model with direction awareness for aerial traffic object detection. IEEE Trans Intell Transp Syst 2026;27. 10.1109/TITS.2025.3642410.
- 15.Guo M, Sheng H, Zhang Z, et al. LLMD: Low-light mask wearing detection with enhanced image recovery and spatially adaptive feature learning. Expert Syst Appl. 2025;270:126528. [Google Scholar]
- 16.Ge S, Li J, Ye Q et al. Detecting masked faces in the wild with LLE-CNNs. Proc IEEE Conf Comput Vis Pattern Recognit. (CVPR). 2017:339–48. 10.1109/CVPR.2017.53.
- 17.Jiang H, Learned-Miller E. Face detection with the Faster R-CNN, in Proc. 12th IEEE Int. Conf. Autom. Face Gesture Recognit., 2017, pp. 1–6. 10.1109/FG.2017.82.
- 18.Xiong L, Tang S, Hu X, et al. EfficientNet MW: A mask wearing detection model with bidirectional feature fusion network. Math Probl Eng. 2022;2022:2621558. [Google Scholar]
- 19.Su X, Gao M, Ren J, et al. Face mask detection and classification via deep transfer learning. Multimed Tools Appl. 2022;81:4475–94. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 20.Guo S, Li L, Guo T, et al. Research on mask-wearing detection algorithm based on improved YOLOv5. Sensors. 2022;22:4933. [DOI] [PMC free article] [PubMed] [Google Scholar]
- 21.Liu H, Qu M. Mask-wearing detection based on YOLOv5 and knowledge distillation. IAENG Int J Comput Sci. 2025;52:1234–45. [Google Scholar]
- 22.Gao Z, Wang J. Improved face mask wearing detection based on YOLOv5. Int J Adv Netw Monit Controls. 2025;10:94–102. [Google Scholar]
- 23.Wang S, Shibghatullah SA, Keoy HK, et al. Pedestrian mask-wearing detection based on YOLOv5 and DeepSORT. Neural Comput Appl. 2025;37:1–24. [Google Scholar]
- 24.Shen J, Liu N, Xu C, et al. Finger Vein Recognition Algorithm Based on Lightweight Deep Convolutional Neural Network. IEEE Trans Instrum Meas. 2022;71:5000413–1. [Google Scholar]
- 25.Li D, Jin Z, Guan C, et al. KACNet: Enhancing CNN feature representation with Kolmogorov-Arnold networks for medical image segmentation and classification. Inf Sci. 2026;726:122760. 10.1016/j.ins.2025.122760.
- 26.Ma X, Dai X, Bai Y et al. Rewrite the Stars, IEEE; 2024. 10.1109/CVPR52733.2024.00544.
- 27.Feng Y, Huang J, Du S et al. Hyper-YOLO: when visual object detection meets hypergraph computation, IEEE transactions on pattern analysis and machine intelligence. 2025;47(4):2388–401. 10.1109/TPAMI.2024.3524377. [DOI] [PubMed]
- 28.Zhao Y et al. DETRs Beat YOLOs on Real-time Object Detection, in 2024 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Seattle, WA, USA. 2024:16965–74. 10.1109/CVPR52733.2024.01605.
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Data Availability Statement
The datasets analysed during the current study are available from the following sources: The original mask segmentation dataset, named “aliyun2610849957”, is publicly available from the Aliyun Tianchi Laboratory (https://tianchi.aliyun.com/dataset/1740). The web-crawled image set described in this study are available from the corresponding author upon reasonable request.






