DICOM to NumPy with Python

Chest CT from Wikipedia (Public Domain)
  • How to use Python to bulk download tens of thousands of medical images as DICOMs from health system storage;
  • How to clean the DICOMs and convert them into…


Tutorial with Code

Source: Wikipedia (Creative Commons license).
  • Understand image dimensions, filter dimensions, and input dimensions;
  • Understand how to choose kernel size, stride, and padding;
  • Understand the basics of object-oriented programming relevant to PyTorch;
  • Understand how to use nn.Sequential for better model organization.

Step 1: Download the code.

The repository with all the code is https://github.com/rachellea/pytorch-computer-vision


Tutorial with Code

This is a photo of Habitat 67 from Wikimedia Commons (license: CC)
  • Select out only part of a pre-trained CNN, e.g. only the convolutional feature extractor
  • Automatically calculate the number of parameters and memory requirements of a model with torchsummary

Predefined Convolutional Neural Network Models in PyTorch

There are many pre-defined CNN models provided in PyTorch, including:


Python, Git, Anaconda, Code, and NO Jupyter Notebooks

Image by Author. Sub-Images are all by author or allowed (see post for individual links).

Python

Python is a great language for machine learning. Python includes a bunch of libraries that are super useful for ML:

  • pandas: data analysis library. pandas dataframes are essentially numpy arrays with descriptive strings as row and column labels. They can be sorted, filtered, grouped, concatenated, etc. Useful for data processing.
  • PyTorch: build neural networks. Includes many pretrained models and clean computer vision datasets. PyTorch is my…


Clinical Recommendations and Machine Learning Applications

In this image the CT slices are from Radiology Assistant. The ROC curves and upper model figure are from Mei et al. The middle model figure is from Li et al.

Diagnosis of COVID-19 with RT-PCR

The gold standard for diagnosis of COVID-19 is reverse transcription polymerase chain reaction (RT-PCR), which is a laboratory test that detects genetic material (RNA) from the COVID-19 virus:


Clinical Goal, Data Representation, Task, Model

Image by Author

Clinical Goal

The clinical goal refers to the medical abnormality that is the focus of the study. The following figure illustrates some example abnormalities, shown as 2D axial slices through the CT volume:


Tasks, How CNNs Work, Learning, AUROC

Example Tasks

Here are some example tasks that can be performed with a CNN:

  • Multilabel Classification: given an input image from a medical scan, determine if the patient has none, some, or all of the following: lung opacity, nodule, mass, atelectasis, cardiomegaly, pneumothorax

How CNNs Work

In a CNN, a convolutional filter slides across an image to produce a feature map (which is labeled “convolved feature” in…


Simulations and Visualizations

AUROC: Area Under the Receiver Operating Characteristic

The AUROC indicates whether your model can correctly rank examples. The AUROC is the probability that a randomly selected positive example has a higher…


Visual Explanations from Deep Networks

Modified from Figures 1 and 20 of the Grad-CAM paper


Cells, DNA, RNA, and Protein

Image Source: Wikipedia, credit to William Crochot.

Rachel Lea Ballantyne Draelos

I am a Duke computer science PhD candidate and medical student (MD/PhD). My PhD is focused on machine learning methods development for medical data.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store