Researchers at Stanford University have trained a computer to detect and distinguish different types of skin cancer — and it performed as well as the board-certified dermatologists it was tested against.

Skin cancer is the most common human malignancy, and is primarily diagnosed visually. The research team, from Stanford’s electrical engineering, dermatology and other departments created a deep learning algorithm to train the computer software — called a “convolutional neural network” — to recognize different benign and malignant moles and lesions.

“We had some good results on cats and dogs. [The computer] could identify 200 breeds of dogs. So we decided to use it for something more useful,” says Brett Kuprel, a doctoral student with Stanford’s department of electrical engineering and first co-author of the study.

The team trained the computer for pattern recognition on millions of images, called transfer learning, which took about a week. They added in and fine-tuned the machine learning on more specific tasks using 129,450 clinical images of 2,032 skin diseases, which the computer mastered overnight.

They then tested the computer to identify the most common cancers, as well as the deadliest, using biopsy label images from pathologists, which Kuprel noted were the “gold standard” of dermatology.

The computer’s competence was comparable to that of 21 dermatologists viewing the same images.

The results, which have been published in the journal Nature, were not surprising. “We’ve seen [the computer’s capabilities] already,” says Kuprel. What was more arduous was the sheer collection of data needed to train the computer, which required a massive data set acquired from all over the internet and took months to find and organize.

What is particularly promising is that anyone with a machine-learning background can train a computer, so one doesn’t necessarily need domain expertise, in this case dermatology, to accomplish that task. “That was cool,” says Kuprel.

Kuprel’s hope is that their efforts will inspire others in machine learning to use artificial intelligence in the health care arena to help identify diseases. He noted that IBM Watson is also working on skin cancer image classification and Google is working on an algorithm to screen for diabetic retinopathy. These efforts have the potential to broaden the scope of care and aid in earlier detection of illness.

“This will not replace dermatologists. It’s a tool that can be used,” he says.