Tuberculosis Detection Using Deep Learning on a Raspberry Pi

Deep learning web server and PACS running on Raspberry Pi

In honor of Pi Day (March 14), we are launching SemanticMD AI Box, our TB detection solution deployed on a Raspberry Pi. We sent our first one out today to Njaboute Foundation based in The Gambia and plan to send a 100 more out to TB clinics and NGOs around the world for evaluation. Contact us if you’re interested in a demo.

TB Detection in Chest X-rays

Source: AfricanStockPhoto

Tuberculosis (TB) is one of the leading causes of death worldwide. In 2015, more than 10 million people fell ill with TB and 1.8 million died from the disease. The World Health Organization (WHO) estimates that two-thirds of the world does not have access to basic radiology services and while TB can be deadly, it’s treatable if diagnosed early enough.

At SemanticMD, we’ve spent a lot of time working with medical device manufacturers and distributors around the world, and we were happy to find that X-ray machines have penetrated almost every market. X-rays are uniquely used for all kinds of common conditions. From fractured bones to lung infections, X-rays form a regular part of patient care.

Chest X-rays (CXR) play a crucial role in TB diagnosis. Although CXRs don’t provide ground truth for confirming TB, they still offer a high sensitivity for detecting TB-related abnormalities in the lungs (scars, opacities, pleural effusion, etc.). In addition, since CXRs provide a low-cost, rapid examination even in remote settings, it has been recognized as a powerful screening test for TB, especially in areas and populations with higher disease burden.

While the cost of acquiring a CXR has become much more affordable, the interpretation of CXR scans is currently limited by cost and access to trained radiologists. Hence, there are many patients that get diagnosed too late and unable to treat their symptoms using conventional TB antibiotics. Many of the TB clinics we’ve been in contact with have X-ray machines or have access to distributors that provide the X-ray screening services; however, the primary barrier globally remains access to trained physicians to perform the readings. Even the UK only averages 7.5 radiologists per 100,000 people.

We developed AI for TB to improve the quality and efficiency of TB screening programs. With low-cost AI screening, more patients can be referred and get the care they need at the right time.

AI at the Edge

Although we believe the future is in the cloud and it’s a great place to write and deploy code, there are situations it can fail to provide the reliability and portability needed.

For our NGO partner in The Gambia, this means lack of reliable internet access and power outages. With that in mind, we’ve optimized our TB detection algorithm to deploy and run within 10 seconds per scan on a Raspberry Pi running on a mobile power bank. We also provide a companion cloud-based platform for continuous learning and improvements on algorithms deployed on SemanticMD AI Box.

We continue to work with our team of developers based in Kigali at Carnegie Mellon Africa to refine algorithms and improve the usability of edge AI solutions. In future posts, we’ll highlight some of the technical challenges overcome in developing and deploying our AI solutions as well as transferring images in low resource environments.


Although AI solutions are a good start, we know that TB clinics need a lot more support. We have started working with volunteer teleradiologists and are actively seeking more collaborators and partners committed to providing solutions for TB. Feel free to reach out to us if you work with or are interested in working with TB clinics.