ARTIFICIAL intelligence (AI) can sometimes be put to rather whimsical uses. In 2012 Google announced that one of its computers, after watching thousands of hours of YouTube videos, had trained itself to identify cats. Earlier this year a secretive AI firm called DeepMind, bought by Google in 2014, reported in Nature that it had managed to train a computer to play a series of classic video games, often better than a human could, using nothing more than the games’ on-screen graphics.

But the point of such diversions is to illustrate that, thanks to a newish approach going by the name of "deep learning", computers increasingly possess the pattern-recognition skills—identifying faces, interpreting pictures, listening to speech and the like—that were long thought to be the preserve of humans. Researchers, from startups to giant corporations, are now planning to put AI to work to solve more serious problems.

One such organisation is the California HealthCare Foundation (CHCF). The disease in the charity’s sights is diabetic retinopathy, one of the many long-term complications of diabetes. It is caused by damage to the tiny blood vessels that supply the retina. Untreated, it can lead to total loss of vision. Around 80% of diabetics will develop retinal damage after a decade; in rich countries it is one of the leading causes of blindness in the young and middle-aged. Much of the damage can be prevented with laser treatment, drugs or surgery if caught early, but there are few symptoms at first. The best bet is therefore to offer frequent check-ups to diabetics, with trained doctors examining their retinas for subtle but worrying changes.

But diabetes is common and doctors are busy. Inspired by recent advances in AI, the CHCF began wondering if computers might be able to do the job of examining retinas cheaply and more quickly.

Being medics, rather than AI researchers, the CHCF turned for help to a website called Kaggle, which organises competitions for statisticians and data scientists. (It was founded by Anthony Goldbloom, who once worked as an intern at The Economist.) The CHCF uploaded a trove of thousands of images of retinas, both diseased and healthy, stumped up the cash for a $100,000 prize, and let Kaggle’s members—who range from graduate students to teams working for AI companies—get to grips with the problem.

The volunteers used the images to train computer algorithms to note the sometimes subtle signs of the disease. The results were impressive. Doctors agree with each other about whether a picture shows diabetic retinopathy and, if so, how serious it is, about 84% of the time, says Jared Teo of the CHCF. After just five months of work, the contest’s winner, Benjamin Graham, a statistician at the University of Warwick, in Britain, was able to come up with an algorithm that agreed with a doctor’s opinion 85% of the time.

That offers a big advantage. An algorithm is cheaper than a doctor (“training” a new one is simply a matter of copying it to another computer). They are quicker, too obviating the need to wait for images to be sent to a lab. An instant diagnosis may help sufferers begin treatment, says Mr Teo. Many of the CHCF’s patients are poor, find it difficult to take time off work, and may struggle to attend a follow-up meeting. And there may be other advantages. Jorge Cuadros, a researcher at the University of California, Berkeley, who has been working with the CHCF, jokes that there is anecdotal evidence that some patients may even take a machine’s judgment more seriously than that of a human doctor.

Eventually, the CHCF wants to deploy the open-source algorithm in clinics throughout California. For now, though, it is being held back by a mix of caution and regulation. “You get a similar problem as you get with driverless cars,” says Dr Cuadros. “Who’s going to take on the liability [if something goes wrong]?” There are regulatory issues, too: the Food and Drug Administration, America’s medical regulator, only recently decided it needed a way to approve AI applications, says Sophia Chang of the CHCF. The plan for the moment is to use the computer only to determine whether a retinal photograph has been properly taken (it is a fiddly job).

But the caution is unlikely to last. Although AI has been one of those fields in which promises often fail to match up to reality and using computers to analyse medical images is not new, new-fangled "deep-learning" algorithms, of which Dr Graham's is one, seem to have solved many of the problems that plagued earlier approaches. “We’ve been able to watch the spread of deep learning on Kaggle,” says Mr Goldbloom. “It’s crushing every image-recognition contest we run.” Startups such as Enlitic, which wants to analyse all kinds of medical images with computers, have been springing up. In August IBM spent $1 billion buying Merge, a medical-imaging company; the idea is to use Merge’s database to teach IBM’s computers. The better computer-aided medicine becomes, the greater the pressure will become to move it out of the lab and into the clinic.