Soon, artificial intelligence could help you spot skin cancer. A new algorithm can now classify some of the most common and fatal skin cancers by images alone, according to a new study.

Researchers from Stanford University trained a machine learning network on more than 129,000 images of skin lesions representing more than 2000 skin diseases, resulting in a system that is about as accurate as human doctors in figuring out whether an off-looking stretch of skin might be cancerous. The system is described in a paper in the journal Nature.

Not all moles and other skin abnormalities look alike, making it difficult to diagnose skin cancer. As of now, doctors visually assess the appearance of the skin, then do a biopsy to confirm whether or not the lesion is malignant. Until now, it has been hard to automate this process, especially considering how different light, angles, and lenses can affect photos.

The researchers trained their algorithm on images of skin lesions that had already been confirmed as malignant by biopsies. In two different validation tests on its ability to recognize examples of the malignant carcinoma and melanoma—both deadly and common—the algorithm performed as well as, if not a little better than, 21 board-certified dermatologists.

It still hasn’t been tested in real-world clinical settings, though, and will have to be validated outside the lab before it can be used in practice. However, considering how deadly skin cancer can be if left untreated—melanoma’s five-year survival rate is 99 percent if it’s caught in its early stages, but only 14 percent if doctors don’t find it until its late stages—any system that can help catch it earlier could save lives.