While texting and driving is illegal, many people are still tempted to send a quick message while behind the wheel.

But a new AI has been designed that could stop you from doing so.

The incredible system can accurately determine when drivers are distracted at the wheel, and could one day be used to develop protective measures.

Scroll down for video

While texting and driving is illegal, many people are still tempted to send a quick message while behind the wheel. But a new computer algorithm has been designed that could stop you from doing so (stock image)

HOW DOES IT WORK? The researchers trained an algorithm using machine-learning to recognise actions such as texting, talking on the phone or reaching into the backseat to get something. The seriousness of the action was assessed based on duration, and other factors, such as head and face positioning. The researchers now hope to combine the detection, processing and grading of several different kinds of driver distraction in a single system. Advertisement

Scientists from the University of Waterloo developed the system, which uses cameras and artificial intelligence to detect hand movements that deviate from normal driving behaviour.

The system can then classify the movements in terms of possible safety threats.

Dr Fakhri Karray, who led the study, said that information could be used to improve road safety by warning or alerting drivers when they are dangerously distracted.

And as advanced self-driving features are increasingly added to conventional cars, signs of serious driver distraction could be employed to trigger protective measures, according to Dr Karray.

He said: 'The car could actually take over driving if there was imminent danger, even for a short while, in order to avoid crashes.'

To develop the system, the researchers trained an algorithm using machine-learning to recognise actions such as texting, talking on the phone or reaching into the backseat to get something.

The seriousness of the action was assessed based on duration, and other factors, such as head and face positioning.

To develop the system, the researchers trained an algorithm using machine-learning to recognise actions such as texting, talking on the phone or reaching into the backseat to get something (stock image)

The study builds upon previous research on the recognition of signs that drivers are falling asleep at the wheel, including frequent blinking.

The researchers now hope to combine the detection, processing and grading of several different kinds of driver distraction in a single system.

Dr Karray said: 'It has a huge impact on society,' adding that distracted drivers are to blame for up to 75 per cent of all traffic accidents worldwide.