How UCloud’s AI Mask Detection Service Reaches 99% Accuracy in One Week

This article explains how UCloud’s AI team leveraged the UAI‑Train and UAI‑Inference platforms to develop, train, and deploy a high‑accuracy face‑mask detection service within a week, detailing the algorithmic approach, challenges, deployment pipeline, and real‑world applications.

UCloud Tech
UCloud Tech
UCloud Tech
How UCloud’s AI Mask Detection Service Reaches 99% Accuracy in One Week

Background

During the pandemic, wearing masks has become essential for travel, and public venues such as airports, train stations, malls, and offices face massive crowds, making manual mask checks inefficient and error‑prone.

Applying artificial‑intelligence technologies to automate mask supervision is therefore urgent.

Face Mask Detection Service – Ready to Use

Recently, UCloud’s AI team built a fine‑grained face‑mask classification algorithm using the UAI‑Train training platform and the UAI‑Inference deployment platform, completing development and launch within one week.

The algorithm achieves 99% accuracy for mask‑wear detection and 95.1% accuracy for correctly worn masks. The mask‑detection API is now online as part of the UAI‑Censor product.

UAI‑Censor Overview

UAI‑Censor is a content‑moderation service built on UCloud’s cloud infrastructure, offering 99.9% service stability and the ability to detect low‑quality content in images and videos, thereby reducing manual review costs.

The newly added face‑mask detection service can quickly locate individuals not wearing masks in public spaces, notify staff, and lower infection risk; it can also be integrated into access‑control gates to block mask‑less entrants.

Algorithm Implementation

Traditional approaches combine face detection with image classification, requiring large labeled datasets for each class (no mask, improper mask, proper mask). The UAI team instead uses a pipeline of face detection, facial‑keypoint localization, mask instance segmentation, and logical judgment, improving both accuracy and generalization while reducing data requirements.

1. Main Challenges

The goal is to automatically identify faces, detect mask presence, and assess proper wearing from camera images. The development workflow includes data preparation, model training, and service deployment, with data collection being the biggest bottleneck.

2. Conventional Solution

Typical methods use detection + classification: detect faces, then classify each face image into three categories. This requires large, diverse datasets for each class, making rapid development difficult.

3. UAI Team Solution

The team’s pipeline consists of:

Face detection (e.g., MTCNN, RetinaNet, SeetaFace) to locate faces.

Facial keypoint localization (5‑point or 68‑point landmarks).

Mask instance segmentation (e.g., U‑Net) to obtain mask masks.

Logical rules combining keypoints and mask masks to determine proper wearing.

This approach reduces data needs, speeds up development, and allows fine‑tuned logic without retraining the model.

Rapid Deployment with UAI‑Train + UAI‑Inference

Building an AI service involves data collection, model training, and online inference, each requiring high‑performance GPU resources. UAI‑Train provides a GPU‑cloud cluster with automated node scheduling, environment setup, data handling, and fault tolerance. UAI‑Inference offers a serverless‑like architecture with dynamic scaling, load balancing, and thousands of inference nodes.

Using these platforms, the team shortened the training cycle and deployed the inference service within a week.

Feature Demonstration

Upload an image to the service and receive mask‑detection results as shown below.

The structured JSON response includes timestamps, detection results, facial landmarks, bounding boxes, and uncovered facial parts.

{
    "Timestamp": 1582013070169,
    "Message": "OK",
    "Code": 0,
    "Results": [
        {
            "Landmark": [308.7552,1094.8477,450.3834,1088.7324,391.5843,1159.5795,333.6577,1236.1418,452.4123,1234.0187],
            "Color": "TODO",
            "Type": 0,
            "Rect": [175,933,383,383],
            "Uncovered": ["NOSE","MOUSE"]
        },
        {
            "Landmark": [3591.2986,971.9404,3680.834,961.0683,3639.8762,1024.175,3605.3523,1061.8948,3681.801,1055.1747],
            "Color": "TODO",
            "Type": 2,
            "Rect": [3517,883,220,220],
            "Uncovered": []
        },
        {
            "Landmark": [803.4313,1154.7069,952.5012,1165.923,852.0828,1228.6077,798.9873,1312.8236,932.0881,1325.9089],
            "Color": "TODO",
            "Type": 2,
            "Rect": [695,1004,408,408],
            "Uncovered": []
        },
        {
            "Landmark": [1841.0995,891.4662,1931.9749,880.6146,1877.4467,951.5715,1851.3187,998.5130,1919.2639,994.3467],
            "Color": "TODO",
            "Type": 2,
            "Rect": [1783,816,220,220],
            "Uncovered": []
        }
    ]
}

Conclusion

The UCloud face‑mask detection service is currently free, and the UAI team plans continuous optimization to support more scenarios.

computer visionAIFace Detectionmask detectionCloud AIUAI-InferenceUAI-Train
UCloud Tech
Written by

UCloud Tech

UCloud is a leading neutral cloud provider in China, developing its own IaaS, PaaS, AI service platform, and big data exchange platform, and delivering comprehensive industry solutions for public, private, hybrid, and dedicated clouds.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.