Deep Learning for Medical Image Analysis

Michał Jurzak

A working portfolio from the Deep Learning in Medical Image Analysis course at AGH. The notebooks start from raw pixel operations and build up to convolutional networks that classify, segment, and generate medical images. Taken together they trace one path: from treating an image as an array of numbers to training a network that reads it the way a clinician would want.

From pixels to networks

The early notebooks stay close to the image itself, with gradients, morphological operations, convolution, and hand-written filters, before any learning is involved. From there the work moves into PyTorch and torchvision: building datasets and dataloaders, training simple networks under supervision, and then the tasks that motivate the whole field, classification and segmentation.

Classification

One concrete task is sorting chest X-rays into normal, COVID-19, and pneumonia. After fine-tuning a pretrained ResNet-18, the model is judged on a held-out set with a confusion matrix, which is where a classifier’s real behaviour shows. The diagonal is strong, and the off-diagonal cells say something useful on their own: the confusions are between normal and pneumonia, while COVID-19 is rarely mistaken for either.

A batch of labelled chest X-rays from the classification task.
Confusion matrix on the test set. The misclassifications cluster between normal and pneumonia.

Segmentation and generation

Segmentation is handled with an encoder-decoder built up to a UNet, in both 2D and 3D, where the goal shifts from one label per image to one label per pixel. The later notebooks turn to generation with autoencoders and variational autoencoders, which learn a compact latent representation and reconstruct or sample images from it. These are the harder, less finished pieces, and the notebooks are honest about where a result is solid and where it is still off.

Source

The notebooks, per-lab write-ups, and figures are in the source repository. The course was taught by Marek Wodziński at AGH.