This project implements an end-to-end Deep Learning pipeline consisting of:
- ✅ Self-Supervised Pretraining using Autoencoders
- ✅ Anomaly Detection via Reconstruction Error
- ✅ Continual Learning to prevent Catastrophic Forgetting
- ✅ Model Evaluation & Performance Comparison
The system demonstrates representation learning, unsupervised anomaly detection, and task adaptation in a modular and scalable setup using PyTorch.
Pretraining (SSL)
↓
Anomaly Detection
↓
Continual Learning
↓
Evaluation & Comparison
- Self-supervised representation learning (no labels required)
- Reconstruction-error–based anomaly scoring
- Percentile-based anomaly thresholding
- Continual learning with regularization to preserve prior knowledge
- Performance comparison between pretrained and continual models
- Clean modular structure for experimentation
- Python 3.x
- PyTorch
- Torchvision
- NumPy
- Matplotlib
continual_dl_project/
│
├── pretrain_ssl.py
├── anomaly_detection.py
├── continual_learning.py
├── evaluation_comparison.py
│
├── best_pretrained_model.pth
├── continual_model.pth
│
└── data/
- Trained an Autoencoder on MNIST dataset.
- Objective: Minimize reconstruction loss.
- Output:
best_pretrained_model.pth
Mean Squared Error (MSE)
- Training loss trend (visualized)
- Saved pretrained model checkpoint
- Loaded pretrained model.
- Computed reconstruction error for each sample.
- Applied 95th percentile threshold.
- Samples exceeding threshold flagged as anomalies.
Reconstruction Error = Mean((Input - Output)^2)
- Adapted model to rotated MNIST (new task).
- Implemented EWC-style regularization.
- Prevented catastrophic forgetting.
- Output:
continual_model.pth
Total Loss = New Task Loss + λ * Weight Regularization
Compared:
- SSL Pretrained Model
- Continual Learning Model
Metric:
- Average Reconstruction Loss (Lower = Better)
Output:
- Bar graph comparison
- Quantitative loss values
- SSL successfully learned robust representations.
- Anomaly detection identified high-error samples.
- Continual learning preserved performance close to pretrained baseline.
- Minimal catastrophic forgetting observed.
- Self-Supervised Learning
- Unsupervised Anomaly Detection
- Elastic Weight Regularization
- Catastrophic Forgetting Mitigation
- Modular Deep Learning Design
python pretrain_ssl.py
python anomaly_detection.py
python continual_learning.py
python evaluation_comparison.py
- Add multiple sequential tasks
- Implement full Elastic Weight Consolidation (Fisher-based)
- Add visualization of reconstructed images
- Deploy as an interactive dashboard
This project demonstrates a complete deep learning workflow from representation learning to continual adaptation.
It highlights practical implementation of advanced ML concepts used in real-world AI systems.
Isha Singh Rathore Deep Learning Enthusiast | PyTorch Developer