This article is more than 1 year old

Microsoft rolls out mask detection to Azure Cognitive Services. And yes, there is a noseAndMouthCovered attribute

For those who find wearing the things so damn difficult

Microsoft has added mask detection, in preview form, to Azure Cognitive Services.

The preview makes use of Spatial analysis, a capability of Computer Vision and part of Azure Cognitive Services. The vaguely unsettling functionality can be used to analyse real-time video in order to count people in a space (for maximum occupancy purposes, for example) as well as keep track of the distance between humans.

A little more retail-friendly are the other insights that can be pulled from the technology, including waiting time in a checkout line and monitoring footfall. Microsoft also touts the technology for keeping an eye out for trespassing.

The feature set has now been extended to detect if a person is wearing a face covering or not; ostensibly handy to know regardless of which side of the great mask debate the operator sits on.

How it works

Switching on the detection for spatial analysis is a simple matter of setting the disabled-by-default ENABLE_FACE_MASK_CLASSIFIER parameter to true. Doing so will cause the attributes face_mask or face_noMask to be populated with a confidence score for each person the system spots in the video stream.

The spatial analysis container can be deployed on edge devices and events are sent back to the Azure IoT Hub as telemetry. From there, developers can fire off other functions depending on what is in the analysis.

A facemask attribute (along with noseAndMouthCovered) has also been added been added to the Azure Cognitive Face API service via the detection_03 model.

Microsoft is by no means the only game in town as far as the spotting of facial coverings goes. The Amazon Rekognition PPE API can be used to spot full head covers as well as face masks and other protective gear. This is important data if an organisation is seeking to ensure compliance with local regulations and, like Microsoft's Spatial analysis additions, relatively simple to tweak as rules change over time.

Those seeking to roll their own without signing up to one of the cloud behemoths can also download face mask recognition code that will run on a variety of platforms, including the humble Raspberry Pi 4.

The area does, however, remain fraught with ethical considerations. "Responsible deployment recommendations for spatial analysisis provided in accordance with Microsoft Responsible AI Principles: fairness, reliability & safety, privacy & security, inclusiveness, transparency, and human accountability," the Windows giant said. ®

More about


Send us news

Other stories you might like