Add diagnosing dangerous lung diseases to the growing list of things artificial intelligence can do better than humans.

A new arXiv paper by researchers from Stanford explains how CheXNet, the convolutional neural network they developed, achieved the feat. CheXNet was trained on a publicly available data set of more than 100,000 chest x-rays that were annotated with information on 14 different diseases that turn up in the images. The researchers had four radiologists go through a test set of x-rays and make diagnoses, which were compared with diagnoses performed by CheXNet. Not only did CheXNet beat radiologists at spotting pneumonia, but once the algorithm was expanded, it proved better at identifying the other 13 diseases as well.

Early detection of pneumonia could help prevent some of the 50,000 deaths the disease causes in the U.S. each year. Pneumonia is also the single largest infectious cause of death for children worldwide, killing almost a million children under the age of five in 2015.

Andrew Ng, a coauthor of the paper and the former head of AI research at Baidu, thinks AI is going to be relied upon in medicine more and more. He previously worked on an algorithm that can, after being trained on electrocardiogram (ECG) data, identify heart arrhythmias better than a human expert. Another deep-learning algorithm recently published in Nature was able to spot cancerous skin lesions just as well as a board-certified dermatologist.

Radiologists in particular have been on notice for a while. Previous research has shown that AI is as good as or better than doctors at spotting problems in CT scans. Geoffrey Hinton, one of the pioneers of deep learning, told the New Yorker that because of the advances in AI, medical schools “should stop training radiologists now.” Analyzing image-based data sets like x-rays, CT scans, and medical photos is what deep-learning algorithms excel at. And they could very well save lives.