How to build an AI product on medical imaging

Khoa Le, Ph.D.
8 min readMay 3, 2024

--

Welcome to our journey through the fascinating world where AI meets medical imaging! In today’s ever-changing healthcare scene, technology is revolutionizing how we diagnose and care for patients. And one of the most exciting areas of innovation is where artificial intelligence (AI) and imaging technologies come together. But to really make the most of AI in medical imaging, we need to combine the amazing technical skills of computer vision with the deep medical knowledge of anatomy and terms.

In this blog, I’ll walk you through what’s happening right now with AI in medical imaging. I’ll talk about the progress we’ve made, the challenges we’re facing, and I’ll share some of the things I’ve learned in this process as a Data Scientist, from setting up experiments, getting data ready, testing models, and dealing with regulations. Think of it as a friendly guide to the cutting-edge world of medical tech. So, let’s dive in and explore together!

Application

AI offers significant benefits in medical imaging by improving the accuracy and efficiency of disease diagnosis. With AI, healthcare professionals can better detect abnormalities, pinpoint specific structures, and even predict disease outcomes. By using machine learning algorithms, AI systems can quickly and precisely analyze medical images, helping to catch diseases in their early stages, which might be challenging to identify using traditional methods. This early detection is crucial because it enables timely interventions, potentially saving lives and leading to better treatment results.

Many companies and startups are advancing in various stages of product development in this field, from initial proof of concept to ready-to-use products for different types of cancer affecting various organs.

https://www.prnewswire.com/news-releases/ai-in-medical-imaging-diagnostics-idtechex-benchmarks-60-companies-301102393.html

An area of particular fascination lies in brain imaging, which serves as a vital tool in unraveling the complexities of the human brain and diagnosing neurological conditions. It emphasizes the critical need for precise tumor detection and classification while acknowledging the hurdles involved.

Brain tumor detection

Lung imaging has attracted considerable research attention, largely because lung cancer tends to be aggressive and is often discovered at an advanced stage, resulting in high mortality rates for cancer patients. Given this scenario, the precise early detection of lung cancer through medical imaging is pivotal for effectively treating lung diseases.

Lung nodule detection and characterization (source)

Liver cancer is the third most common cause of death from cancer worldwide [2], and its incidence has been growing. Again, the development of the disease is often asymptomatic, making screening and early detection crucial for a good prognosis.

Liver segmentation, visualization with 3D Slicer (source)

Challenges

When creating an AI tool for medical imaging, the first big question is figuring out what specific problem it will solve. Understanding how doctors diagnose diseases is crucial to making sure the tool actually helps them and their patients. It’s important to determine whether there’s a real need for the tool or if it’s just adding something obvious. And of course, it has to be valuable enough for hospitals or clinics to invest in.

For example, let’s consider developing an AI tool to detect fractures in X-ray images. While it might seem like a useful idea at first glance, it’s important to delve deeper into how fractures are typically diagnosed. In many cases, when a patient comes in with a suspected fracture, they’re already experiencing pain or discomfort in that area. Doctors often order X-rays to confirm the diagnosis, but they usually have a pretty good idea of where the fracture might be based on the patient’s symptoms and physical examination.

Having already identified the application, conducted market research, and gathered valuable insights from potential clients on how they envision their workflow could be optimized with your product, it’s time to bring your vision to life. With a solid understanding of your target audience’s needs and pain points, you can now finalize your product design and begin building a solution that truly meets their requirements.

Developing a machine learning product is a complex endeavor that goes far beyond simply building a model. It’s a collaborative effort that requires a diverse team of experts working together to bring a product to life. The process is multifaceted, involving several key stages, as illustrated below.

Machine learning product development process (source)

From collecting and integrating input data from various sources to labeling and versioning the data, the journey is long and winding. Next, the model is developed and trained on this data, followed by rigorous evaluation to ensure its accuracy. Finally, the model is deployed to end-users, marking the culmination of the process.

In the medical imaging domain, the stakes are even higher, as compliance with regulations is a critical aspect of the development process. In the next part of this series, I’ll delve into the intricacies of data preparation, model development, and deployment, providing valuable insights for those looking to navigate the complexities of building a machine learning product

Data

The key to making any machine learning project successful is getting the data ready. You’ve probably heard the saying “garbage in, garbage out,” which means if you start with bad data, you’ll get bad results. This is especially true in medical imaging. Data can come from lots of places like hospital systems, data providers, or public datasets. Setting up a good system to collect this data is really important and should be done early on.

In the medical field, putting the data together can take a long time, sometimes months. This is because there are lots of steps involved like negotiating contracts, making sure patient information is kept private, finding the right patients to include, and waiting for follow-up appointments. It’s also important to know who the target patients are so that the data we collect matches the people the product is meant to help.

But even after we have the data, there’s still tons of work to do. The data often comes in different formats and uses different names for things, so we have to clean it up and make sure everything is labeled correctly. Since medical terms can be pretty complicated, it’s best to have specialists handle this part to make sure it’s done right.

Once the data is cleaned up, we need to go through a process called “truthing,” where specialists look at images and reports to mark important things. This can be tricky because different specialists might have different opinions about what they see. So, we have to find a way to come to an agreement about what’s important.

Versioning data is also an important task, since each version of model is trained on a corresponding version of data, data should be versioned with tools like DVC in order to trace back the experiment.

Handling all these challenges is really important because it helps us make sure our models give the right results.

Metric

Before developing models, we should defined how can we evaluated them, as single component and as whole pipeline. In team where there are several Data Scientists, each one train their own part of the product, we must prepare the common ground where everyone can validate their product, in order to keep consistency of results between model in development and model in validation, or between module validation and pipeline validation.

For classification problems, we use familiar metrics such as accuracy, precision, recall or AUC to evaluate classification models. In medical domain, in most of the time there are highly imbalance issue, since the population of negative classes is much higher than positive classes, accuracy and AUC tends to provide optimiste idea about model’s performance, you should always look at precision and recall to understand your model bettwer.

For object detection problem, FROC seems to be an obvious choice where it shows your the sensitivity in trade off for number of false positives per image. LROC is also a good choice to calculate ROC, with consideration of detection result.

In segmentation model, DICE have been used for most of the time, but Haursdoff distance is also useful to evaluate the surface difference of two segmentations.

Method

In general, the same Computer Vision techniques used for analyzing natural images can be applied to medical images. This includes methods like UNET for segmentation, YOLO or RetinaNet for object detection, and various architectures for classification tasks. Recent advancements such as Segmented Anything Model (SAM), tailored for instance segmentation, have introduced specific versions for organ segmentation across diverse modalities of medical imaging.

Typically, no single model can excel across all datasets (generality). Instead, employing an ensemble of multiple models tends to yield superior performance in most cases. In the realm of product development, Data Scientists often face time constraints, juggling various tasks such as processing datasets of different formats, attending meetings, and compiling reports. Hence, a data-centric approach is usually more feasible than focusing solely on crafting new models. A well-processed and annotated dataset becomes a valuable asset for a company.

Organ segmentation in Total Segmentator dataset.

Deployment, Integration, and Regulatory

Don’t forget how crucial it is to put your model into action smoothly. The model trained by Data Scientists in the development process still needs much effort to integrate into the production pipeline on either in-house hardware or a cloud system. Some of the challenges at this stage:

  1. Data distribution shift: data used to train the model does not match the data it’s tested on.
  2. Bug: glitches or things that aren’t supposed to happen in the product.
  3. Repetitive tasks: Data Scientists can focus on research instead of worrying about deploying or validating the product. Other teams can handle that part quickly and automatically.

Regulations are becoming more important, especially for AI products. In medical imaging, things get even trickier. You have to go through several validation stages and test your product on a special set of data to prove it does what you say it does. You’ve got to document everything, from the tools you used to the reports you generated.

If you manage to optimize the whole development and integration process well, you can easily fix bugs, choose hyperparameters, generate reports for regulation, etc.

Conclusion

In this blog, you’ve explored how companies are leveraging AI in medical imaging, particularly focusing on Deep Learning models for diagnosing diseases, especially in the early stages of cancer detection. I’ve also highlighted key considerations in data preparation, model development, evaluation metrics, and integration. I hope you’ve found this discussion engaging. Feel free to reach out to me via email or LinkedIn for further conversations.

Reference

[1] Pinto-Coelho L. How Artificial Intelligence Is Shaping Medical Imaging Technology: A Survey of Innovations and Applications. Bioengineering (Basel). 2023 Dec 18;10(12):1435. doi: 10.3390/bioengineering10121435. PMID: 38136026; PMCID: PMC10740686.

[2] World Health Organization Cancer Key Facts. [(accessed on 16 June 2023)]. Available online: https://www.who.int/news-room/fact-sheets/detail/cancer

--

--

Khoa Le, Ph.D.

I do Data Science on Medical Imaging and Finance, and love them both.