back to projects
Gen AI Medical Imaging Python

Data Augmentation with Generative AI

Dr. K Nirmala, SSN Biomedical Engineering · May 2022

Aim

Deep Learning methods require large datasets to overcome overfitting and class generalization problems. Well-annotated and sufficient datasets are expensive economically and computationally to produce and store — a problem especially aggravated in the biomedical field.

This project originated from attempting to apply segmentation techniques to medical image datasets and realizing there simply wasn't enough data to train models. The focus shifted to augmentation techniques for medical image datasets.

Dataset: VinDr SpineXR

A large-scale annotated medical image dataset for spinal lesion detection and classification from radiographs. Contains 10,466 spine X-ray images from 5,000 studies, each manually annotated with 13 types of abnormalities by an experienced radiologist.

Lesion types

Ankylosis, Disc space narrowing, Enthesophytes, Foraminal stenosis, Fracture, Osteophytes, Sclerotic lesion, Spondylolysthesis, Subchondral sclerosis, Surgical implant, Vertebral collapse, Foreign body, and Other lesions.

The dataset was selected because of its significant class variance and imbalance — 13 different disease types with only 100–200 images each.

Test Networks

VGG16

Convolutional neural network architecture developed by the Visual Geometry Group (VGG) at the University of Oxford. Renowned for its simplicity and effectiveness in image classification and object recognition.

Inception Net

Also known as GoogLeNet, introduced by Google in 2014. A significant advancement in deep learning for computer vision, particularly in image classification and object recognition.

Basic Augmentation Techniques

Implemented using the PIL package:

  • 45° Rotation
  • 270° Rotation
  • Horizontal Flip
  • Vertical Flip
  • Cropping ((2, 5, 500, 1000))
  • Zooming (crop → resize (500, 500))
  • Shearing — 30 radians

GAN-Based Augmentation

Generative Adversarial Networks consist of two AI networks that compete against each other to minimize loss. The generative network produces synthetic images, and the adversarial network classifies them as "fake" or "real." Learning is back-propagated through both networks until the generator produces increasingly realistic outputs.

DCGAN

Deep Convolutional GAN: uses convolutional and convolutional-transpose layers, batch normalization, ReLU/LeakyReLU activations, and strided convolutions instead of pooling layers.

Limitations observed:

  • Unable to generalize due to skull-neck vs. lumbar spine differences in the dataset
  • Training instability between generator and discriminator
  • Maximum output image size 64×64 due to GPU memory constraints
  • 2–3 hours per 200 epochs training time

WGAN

Wasserstein GAN: replaces the discriminator with a critic estimating Wasserstein distance, uses weight clipping to enforce Lipschitz continuity.

Advantages:

  • More stable training process
  • Meaningful loss metric that correlates with image quality
  • Reduces mode collapse
  • Less sensitive to architecture choices and hyperparameters

Hybrid Augmentation Method

A novel hybrid technique combining the best-performing basic augmentation strategies (Rotation 45°, Rotation 270°, Shearing) with WGAN-generated images, providing more training data volume while preserving class characteristics.

Conclusion

Best-performing basic augmentation combined: ~88% (VGG-16) and ~83% (InceptionNet) accuracy. Worst-performing combined: ~81% and ~80%.

Best individual augmentation techniques for the VinDr spine dataset: Rotation 45°, Rotation 270°, and Shearing.

The hybrid augmentation (WGAN + best basic strategies) achieved 98–99% accuracy across all three spine abnormality cases for both VGG-16 and InceptionNet classifiers — outperforming basic augmentation alone or WGAN generation alone.