The social media platform, Twitter, has been a tool for organizing and promoting protests in recent times. In many cases, these protests turn violent with activists and authorities clashing. To help combat this issue, researchers from the University of Southern California’s Brain and Creativity Institute are utilizing artificial intelligence (AI) to try predict and prevent the point where protests will turn violent.

The psychologists at USC, along with computer scientists, created an artificial intelligence algorithm that scanned posts and correlated their content with impending violence at protests. This tool could be pivotal in better preparing for demonstrations that are prone to escalation.

Machine learning was used to analyze 18 million tweets posted during the Baltimore protests in 2015, which developed when Freddie Gray fell into a coma on police transport and later died. The system scanned arrest rates, a metric that’s often used as a proxy for violence, and found that arrests increased as “moralized” tweets (i.e. those related to issues the posters could deem as right or wrong) increased. The number of arrests during the demonstrations were found to correlate with the number of moral tweets posted in the hours leading up to the protests.

A group of researchers from the UK and India have also utilized AI to identify people using deep learning to enhance facial recognition capabilities during protests, even when demonstrators are obscuring their identity. The deep learning system looks at 14 points on a face and measures the distances between them in order to recognize people, achieving a 56 percent success rate in identifying subjects in disguise.