Walmart is developing facial recognition technology to detect frustrated or unhappy shoppers.

The technology uses video cameras at store checkout lines that monitor customers’ facial expressions and movements to try and identify varying levels of dissatisfaction, according to a patent filing.

If the system detects an unhappy customer, it will ping employees in other parts of the store and order them to report to a checkout register, in the hopes of alleviating shoppers’ distress.

Walmart is hoping that the technology will enable stores to respond more efficiently to customer service issues before shoppers have a chance to complain.

“It is easier to retain existing customers than acquire new ones through advertising,” the patent filing reads. “Often, if customer service is inadequate, this fact will not appear in data available to management until many customers have been lost. With so much competition, a customer will often simply go elsewhere rather than take the time to make a complaints.”

The Wall Street Journal reported earlier on the patent.

Walmart will not only use the data to address immediate staffing needs. It will also use the technology to analyze trends in shoppers' purchase behavior over time, according to the patent filing.

To analyze purchasing behavior, the system links customers' facial expressions or "biometric data" as its called in the paten filing to their transaction data - meaning how much they are spending and what they are buying.

Walmart says this will help stores detect changes in a customers' purchase habits due to dissatisfaction.

"Significant drops or complete absence of customers spending ... may be identified," according to the patent filing.

Walmart has previously tested facial reconition technology, but later abandoned the program because it was ineffective. In 2015, the company tested the technology in an unspecified number of stores to try and detect shoplifters and prevent theft.