15 Using segmentation to find suspected nodules

 

This chapter covers

  • Modifying the data to be used for a 2D segmentation problem
  • Performing segmentation with Segment Anything
  • Understanding mask prediction using Segformer
  • Fine-tuning a segmentation model

In the last four chapters, we have accomplished a lot. We’ve learned about CT scans and lung tumors, datasets and data loaders, and metrics and monitoring. We have also applied many of the things we learned in part 1, and we have a working classifier that determines whether CT scan candidates are nodules or not nodules.

However, we are still operating in a somewhat artificial environment since we require hand-annotated nodule candidate information (our annotations.csv and candidates.csv files) to load the candidates into our classifier. How can we automatically determine which parts of a CT scan are nodule candidates? This is the question we will address in this chapter.

As we explained at the start, our project uses multiple steps to solve the problem of locating possible nodules and identifying as nodules or not. This is a common approach among practitioners, while in deep learning research there is a tendency to demonstrate the ability of individual models to solve complex problems in an end-to-end fashion. The multistage project design we use in this book gives us a good excuse to introduce new concepts step by step.

15.1 Utilizing a second model in our project

15.2 Various types of segmentation

15.3 Semantic segmentation: Per-pixel classification

15.3.1 The Segment Anything Model (SAM)

15.4 SAM Architecture

15.4.1 Trying out an off-the-shelf model for our project

15.5 Using the SAM model directly

15.6 Updating the dataset for segmentation

15.6.1 Working around SAM’s limitation on 2D data

15.6.2 Building the segmentation dataset

15.6.3 Training a model to flag potential candidates

15.7 Updating our training for fine tuning

15.7.1 How to fine tune a model

15.7.2 Using the AdamW optimizer

15.7.3 Designing our training loop

15.7.4 Saving our model

15.8 Inference and results

15.9 Conclusion

15.10 Exercises