Skip to content

ishasinghrathore37/continual_dl-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Advanced Deep Learning System

Self-Supervised Learning • Anomaly Detection • Continual Learning

📌 Overview

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.


🧠 Project Architecture

Pretraining (SSL)
        ↓
Anomaly Detection
        ↓
Continual Learning
        ↓
Evaluation & Comparison

🚀 Features

  • 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

🛠️ Tech Stack

  • Python 3.x
  • PyTorch
  • Torchvision
  • NumPy
  • Matplotlib

📂 Project Structure

continual_dl_project/
│
├── pretrain_ssl.py
├── anomaly_detection.py
├── continual_learning.py
├── evaluation_comparison.py
│
├── best_pretrained_model.pth
├── continual_model.pth
│
└── data/

🔍 Phase 1: Self-Supervised Pretraining

  • Trained an Autoencoder on MNIST dataset.
  • Objective: Minimize reconstruction loss.
  • Output: best_pretrained_model.pth

Loss Function

Mean Squared Error (MSE)

Output

  • Training loss trend (visualized)
  • Saved pretrained model checkpoint

🚨 Phase 2: Anomaly Detection

  • Loaded pretrained model.
  • Computed reconstruction error for each sample.
  • Applied 95th percentile threshold.
  • Samples exceeding threshold flagged as anomalies.

Anomaly Score

Reconstruction Error = Mean((Input - Output)^2)

🔁 Phase 3: Continual Learning

  • Adapted model to rotated MNIST (new task).
  • Implemented EWC-style regularization.
  • Prevented catastrophic forgetting.
  • Output: continual_model.pth

Continual Objective

Total Loss = New Task Loss + λ * Weight Regularization

📊 Phase 4: Evaluation & Comparison

Compared:

  • SSL Pretrained Model
  • Continual Learning Model

Metric:

  • Average Reconstruction Loss (Lower = Better)

Output:

  • Bar graph comparison
  • Quantitative loss values

📈 Results Summary

  • SSL successfully learned robust representations.
  • Anomaly detection identified high-error samples.
  • Continual learning preserved performance close to pretrained baseline.
  • Minimal catastrophic forgetting observed.

🏆 Key Concepts Demonstrated

  • Self-Supervised Learning
  • Unsupervised Anomaly Detection
  • Elastic Weight Regularization
  • Catastrophic Forgetting Mitigation
  • Modular Deep Learning Design

💡 How to Run

1️⃣ Pretraining

python pretrain_ssl.py

2️⃣ Anomaly Detection

python anomaly_detection.py

3️⃣ Continual Learning

python continual_learning.py

4️⃣ Evaluation

python evaluation_comparison.py

📌 Future Improvements

  • Add multiple sequential tasks
  • Implement full Elastic Weight Consolidation (Fisher-based)
  • Add visualization of reconstructed images
  • Deploy as an interactive dashboard

📜 Conclusion

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.


👩‍💻 Author

Isha Singh Rathore Deep Learning Enthusiast | PyTorch Developer

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages