In October, a teenager in New York City died after jumping in front of a subway train. This tragedy isn’t isolated. Last year, 608 people from 18 U.S. states died by suicide after jumping or laying before a moving object, according to the CDC.

A researcher from Canada has an idea for how to prevent these kinds of deaths.

Brian Mishra, director of the Center for Research and Intervention on Suicide and Euthanasia at the Université du Québec à Montréal, thinks artificial intelligence could sound the alarm before it’s too late. By analyzing behaviors on surveillance cameras, he hopes his system could identify those people on train platforms who may be about to intentionally put themselves in the path of a train.

Mishara and his students watched film of grim footage in their work. For a new study published in the journal BMC Public Health, they analyzed 63 suicide attempts that occurred in the Montréal metro railway as filmed by closed-circuit television systems.

Even when train track suicides are accomplished, they learned that it’s not unusual for people to change their mind or have second thoughts in the short time between when they place themselves on the track and when the train approaches. In their observations, 75 percent of those who made these attempts expressed perceived ambivalence beforehand, doing things like waiting for several trains to pass before making their move or trying to get out of the path of the train at the last minute.

“A lot of people try to change their mind,” he told Vocativ. “That was the most unsettling part of watching those videos. What usually happens is that suicidal people are looking for some alternative to ending their life in order to stop their suffering or misery or deal with the situation that they feel unable to handle.”

He also noted that many suicides attempted this way do not go as planned, often leaving victims to permanent disfigurement or prolonged periods of suffering before eventual death in the hospital. (While data on the failure rate of suicide attempts are difficult to come by, he notes that two-thirds of these kinds of attempts in Montreal, where he is based, do not result in death.)

The videos did teach them that many suicide attempts might be predictable. Potential signs of risk were observed just under half of the time, such as often to see if the train is coming, standing on the line the marks the edge of the platform, pacing between that line and the wall, walking along the line, placing objects on the edge of the platform and practicing jumping. Time also appears to be on the side of those looking to foil these attempts. Of the attempts in which they could calculate the amount of time elapsed, the majority waited at least 6 minutes.

Since most potential bystanders aren’t trained in how to recognize these behaviors and it’s infeasible to have humans monitoring all platforms at all times, the team believes a software program that uses computer vision could be a good solution. In this kind of scenario, the authors imagine a program could analyze the video, flag the attention of a human, and signal train drivers to slow down or use caution in approaching the station.

While that kind of technology is still a ways off, researchers employed at Google found it is possible to “teach” deep neural networks how to recognize and analyze human poses and posturing three years ago, in a project called “DeepPose.”

Asked about the feasibility of Mishair’s imagined implementation for the purpose of suicide risk ask assessment, DeepPose researcher Alexander Toshev says he is optimistic.

“Human pose estimation has gotten quite accurate over the last couple of years,” Toshev told Vocativ in an e-mail. “If one can detect such events based solely on the location and movement of body parts, then there is a good chance that current pose estimators can be successfully applied.”

Until this kind of technology is actually implemented, however, Mishair advocates for a less technical but highly effective method used in Hong Kong: having cities install automatic barriers that block people from accessing the track unless the train is already safely stationed.