Community Blog Learn How Alibaba Engineers Accommodated for Face Masks in their Algorithms

Learn How Alibaba Engineers Accommodated for Face Masks in their Algorithms

Learn how Alibaba engineers accommodated for face masks in their image recognition algorithms in response to coronavirus outbreak.

In order to win this inevitable battle and fight against COVID-19, we must work together and share our experiences around the world. Join us in the fight against the outbreak through the Global MediXchange for Combating COVID-19 (GMCC) program. Apply now at https://covid-19.alibabacloud.com/

By ApsaraDB


With the increasing threat of the novel coronavirus, social distancing is an important means of preventing the further spread of the virus. In China, soon after the virus started to spread, many local governments imposed strict regulations on the movements of residents. In particular, on February 3, the Yuhang district of Hangzhou city issued the "Ten Strict" control measures:


These restrictions brought new challenges and problems to community management. For example, most community complex entry and exit records were done manually, which would often result in errors and omissions, making it difficult to enforce this social distancing measure effectively.

To solve these access management problems, the Alibaba Cloud Intelligent database vector search team provided a set of image recognition models for free. And, importantly, given the times, these models could work well even when people are wearing face masks. The vector search capabilities helped to set up a community resident management solution, which has been made open source.

The solution that Alibaba Cloud implemented effectively improved the efficiency of community access management during the epidemic in China, and it can be used to do the same elsewhere. Our team at Alibaba were able to provide these systems and the AnalyticDB database engine free of charge for all the access management applications that are connected or related to the coronavirus epidemic.

Next, we will introduce our solution and give a detailed description of key technologies involved in image recognition and AnalyticDB vector search to help developers perform secondary development. Last, we will provide the address of the open-source product.

Community Resident Management Solution

What the Community Resident Management Solution Does

During this time, for obvious reasons, people often wore face masks, and keeping them on was important, as having to remove face masks would increase the risk of contracting the disease. Therefore, our solution provides a set of algorithms to enable the detection of mask wearing among individuals, as shown below:


Community managers can use cameras to automatically detect masks and report all entry and exit records of a person detected without masks. This makes it easier for community administrators to efficiently manage access permissions for those who do not comply with mask wearing rules.


The solution also features statistical analysis capabilities, which provide global metrics for community administrators.

Overall Application Architecture Design

The figure to follow shows the overall architecture of the access management system. The frontend interface is implemented through HTML and JavaScript. You can query entry and exit records over the past two days.


Key Technologies

Mask Detection Algorithm for Epidemics

The following figure shows how the algorithm works. During the registration process, various models are used to extract the features. Then, the extracted feature vectors are written to AnalyticDB. During the query process, the mask detection model is first used to check whether the detected person is wearing a mask.


The mask detection model used in the system is open-source. Testing showed that the accuracy of the mask detection model is greater than 99.5%.

As you can see, even when only eye features are used, the AnalyticDB model still has a recognition accuracy of over 99% on the LFW dataset.

Features of the AnalyticDB Vector Edition

AnalyticDB is a high-concurrency, low-latency, and real-time data warehouse on Alibaba Cloud, which supports petabytes of data. It supports instant multi-dimensional analysis and service exploration for trillions of data entries within milliseconds.

AnalyticDB for MySQL is fully compatible with the MySQL protocol and the SQL:2003 standard. AnalyticDB for PostgreSQL supports SQL:2003 and is highly compatible with the Oracle syntax ecosystem. Currently, both products support vector search and similarity query and recommendation systems for vehicles and other objects.

In actual application scenarios, AnalyticDB can query billions of vector data entries and respond within 100 milliseconds. AnalyticDB has been widely used in security projects across multiple cities.

In general application systems that involve vector search, developers usually use a vector search engine, such as Faiss, to store vector data and then use relational databases to store structured data. This means you have to alternate between both systems during queries. Moreover, this solution requires extra development work and does not provide optimal performance.

AnalyticDB supports the retrieval of structured and non-structured data, or vectors. This means you can simply use an SQL interface to quickly implement image search and hybrid image + structured data search. In hybrid search scenarios, the optimizer of AnalyticDB selects the optimal execution plan based on data distribution and query conditions in order to achieve optimal performance while ensuring retrievability.

In the access management system, AnalyticDB allows you to query access records by combinations of photo, gender, age, start time, and end time conditions.

With the image + structure data search function, you can run an SQL statement to perform the following operations:


Hybrid structured + non-structured information retrieval is widely used in practical applications.

While continuing to wage war against the worldwide outbreak, Alibaba Cloud will play its part and will do all it can to help others in their battles with the coronavirus. Learn how we can support your business continuity at https://www.alibabacloud.com/campaign/supports-your-business-anytime

0 0 0
Share on

Alibaba Clouder

2,600 posts | 753 followers

You may also like