Name: Harsh Santosh Gelda
PRN: 22UF17379CM017
Class: Btech4 16
Tutorial 7
Scenario-Based Question
A healthcare technology company is developing an AI system to analyze medical images such as
MRI scans. The dataset is limited, and collecting more labeled data is expensive and
timeconsuming. The company wants to generate realistic synthetic medical images to improve
model training and also learn meaningful latent representations of the data for anomaly
detection.
Question:
Explain how a Variational Autoencoder (VAE) can be used in this scenario. Describe its
working mechanism and justify why it is suitable for generating new medical images and
detecting anomalies.
Ans:
A Variational Autoencoder (VAE) is a powerful generative model that fits this healthcare
scenario very well because it can both generate realistic synthetic data and learn structured latent
representations useful for anomaly detection.
1. How a VAE Works (Conceptual Overview)
A VAE consists of two main parts: (a) Encoder
● Takes an input image (e.g., MRI scan)
● Compresses it into a latent space distribution (not a single point) ● Outputs:
○ Mean (μ)
○ Variance (σ²)
(b) Latent Space Sampling
● Instead of fixed encoding, it samples:
z∼N(μ,σ2)z \sim \mathcal{N}(\mu, \sigma^2)z∼N(μ,σ2)
● This introduces controlled randomness, allowing generation of new data
(c) Decoder
● Takes sampled latent vector zzz ● Reconstructs the image Training Objective
The VAE optimizes two things:
1. Reconstruction Loss
→ Ensures output image ≈ input image
2. KL Divergence Loss
→ Forces latent space to follow a normal distribution
2. Why VAE is Suitable for This Scenario
(A) Generating Synthetic Medical Images ● Once trained, you can:
○ Sample zzz from standard normal distribution
○ Pass it through decoder → generate new MRI images
Benefits:
● Helps overcome limited dataset
● Produces diverse but realistic samples
● Improves model generalization
Especially useful when:
● Data collection is expensive (like medical imaging) ● Privacy constraints limit real data
usage
(B) Learning Meaningful Latent Representations
● VAE learns a smooth, continuous latent space
● Similar images → close in latent space
● Different conditions (healthy vs abnormal) → separable clusters
Why this matters:
● Helps in:
○ Feature extraction
○ Visualization
○ Downstream tasks (classification, clustering)
(C) Anomaly Detection
This is where VAE becomes especially powerful.
Idea:
● Train VAE on normal (healthy) MRI scans only During testing:
● Input abnormal image (e.g., tumor)
● VAE tries to reconstruct it as “normal”
Result:
● High reconstruction error → anomaly detected
Why it works:
● VAE learns distribution of normal data
● Cannot reconstruct unseen abnormalities well ● Difference = signal of anomaly
3. Step-by-Step Use in This Scenario
1. Train VAE on available MRI dataset 2.
Use encoder to learn latent distribution
3. Generate synthetic images:
○ Sample latent vectors
○ Decode into new MRIs
4. Augment dataset with synthetic images
5. Train diagnostic AI model on enriched dataset
6. Use reconstruction error for anomaly detection
4. Key Advantages in Healthcare Context
● Works well with limited labeled data
● Generates privacy-preserving synthetic data
● Enables unsupervised anomaly detection
● Learns interpretable latent structure
● Reduces dependency on expensive annotations
5. Simple Intuition Think of VAE as:
“Learning the essence of what a normal MRI looks like — and using that knowledge to both
create new scans and detect when something doesn’t fit.”
6. Conclusion
A Variational Autoencoder is ideal for this scenario because it:
● Generates realistic synthetic medical images → solves data scarcity
● Learns structured latent representations → useful for understanding data
● Detects anomalies via reconstruction error → critical for diagnosis
This makes VAE a dual-purpose solution for both data augmentation and clinical insight
extraction.