Automated age checks using artificial intelligence (AI) analysis of people’s faces will be trialled at supermarket tills next month under government plans to prevent children buying alcohol.

The Home Office is set to launch the first supermarket pilots of the AI technology, which has learned to estimate the age of 16 and 17-year-olds to within one year of accuracy after analysing tens of thousands of images.

The technology could replace ID cards and officials believe it will help to prevent under 18s from buying alcohol and cut violence against shop workers, who blame ID checks for leading to abuse from young customers.

It could also save time on current ID checks that can cause disorderly queues, as well as enabling automated age verification for alcohol bought via click and collect.

The technology has already been deployed by the Post Office, police, NHS, NSPCC and social media through Yoti, a company specialising in digital identity verification.

Yoti’s technology is integrated into self-checkout systems that are used by major supermarket chains such as Tesco, Sainsbury’s, Asda and Morrisons but has not been able to be deployed because of UK licensing laws.

The Home Office “alcohol sandbox” trials to be announced next month will enable the AI technology to be activated, as long as it is operated legally and agreed with local licensing authorities and police.

Shops are currently required by law to ensure no one under 18 buys alcohol, and must check ID documents where there is doubt. Illegal sales carry a maximum penalty of up to six months in prison and/or a fine up to £5,000.

Customers buying alcohol at the ID checkouts have to consent to their picture being taken by the camera, with the AI technology able to be set higher than the legal age – for example, 21 – to allow for the margin of error.

Yoti’s facial analysis system, which cannot link a face to an identity, uses an AI-powered algorithm trained to check the age of faces with an average accuracy of within 1.5 years for those aged 13-24, rising to under a year for 16 and 17-year-olds.

If the customer agrees, the checkout will take a photo of their face. The software works to approximate their age and the image is automatically deleted. Yoti claims the only data shared with the retailer is the age check and that a human will never see the picture.

If the system determines the customer looks younger than the set age, they have the option to share their date of birth anonymously with the system via Yoti’s smartphone app by scanning a QR code on the terminal’s screen. Alternatively, customers can wait for store approval from a human assistant.