Skip to content

gcanurag/Diffusion-Augmented-Particle-Event-Classification

Repository files navigation

🧪 Particle Event Simulation, Diffusion-Based Augmentation, and Classification

📌 Overview

This project presents an end-to-end physics-aware pipeline for simulating, augmenting, classifying, and generating particle detector events using deep learning.

The workflow closely mirrors real high-energy physics (HEP) analysis pipelines:

Physics-inspired simulation
        ↓
Class-conditioned diffusion (data augmentation)
        ↓
CNN / Vision Transformer classification
        ↓
Physics-consistent evaluation

The project is suitable for academic research, HEP ML coursework, and BE level experimentation.


🧩 Particle Classes

Class ID Particle Physical Meaning
0 Muon Straight minimum-ionizing track
1 Electron Compact electromagnetic shower
2 Hadron Chaotic hadronic shower

🔬 Physics-Inspired Detector Simulation

Image Properties

  • Resolution: 64 × 64
  • Single-channel grayscale
  • Gaussian blur + detector noise
  • Normalized per image

Event Characteristics

🟢 Muon

  • Straight-line trajectory
  • Minimal lateral spread
  • Low energy deposition

🔵 Electron

  • Compact EM shower
  • Radially symmetric
  • Moderate energy

🔴 Hadron

  • Multi-cluster structure
  • Highly stochastic
  • Large energy fluctuations

Dataset Preparation

Simulated samples in BW

Simulated samples

Muon Samples

Muon Samples

Hadron Samples

Hadron samples

Electron Samples

Electron samples


🌫️ Diffusion-Based Event Generation (Before Classification)

Why Diffusion Comes First

In real experiments, Monte-Carlo generators produce large datasets before reconstruction or classification.

Here, a class-conditioned diffusion model (DDPM) acts as a learned Monte-Carlo generator, producing realistic detector events used to augment training data.

Model Details

  • UNet-based DDPM (diffusers.UNet2DModel)
  • Explicit class conditioning
  • Noise scheduler: squaredcos_cap_v2

Energy Conservation

Generated events are rescaled to satisfy:

Electron samples

Class Target Energy


Muon 300 Electron 2000 Hadron 3500

This mimics calorimeter energy calibration.


🔬 Physics Interpretation of Generated Events

  • Muons: Straight coherent tracks preserved by diffusion
  • Electrons: Smooth compact showers with radial falloff
  • Hadrons: Complex multi-cluster stochastic structures

Diffusion successfully captures class-specific topology and energy flow, making it suitable for physics-aware augmentation.


DDPM Generated samples in B/W

DDPM Augmentation

Augmented samples


Final Combined Samples in B/W

DDPM Augmentation

Final samples


🧠 Supervised Classification Models

CNN -- VGG16

  • ImageNet pretrained backbone
  • Frozen convolutional layers
  • Custom classifier head
  • Strong local inductive bias

Vision Transformer -- ViT-B/32

  • Pretrained ViT encoder
  • Global self-attention
  • Better modeling of complex hadronic topology

Final Training Dataset

Train Test Data


CNN (VGG16) Results

Accuracy Curve

VGG Accuracy

Loss Curve

VGG Loss

Confusion Matrix

VGG Confusion Matrix

Normalized Confusion Matrix

VGG Normalized CM

Precision–Recall Curve

VGG PR Curve

ROC Curve

VGG ROC Curve

Sample Predictions

VGG Predictions


Vision Transformer (ViT) Results

Accuracy Curve

ViT Accuracy

Loss Curve

ViT Loss

Confusion Matrix

ViT Confusion Matrix

Normalized Confusion Matrix

ViT Normalized CM

Precision–Recall Curve

ViT PR Curve

ROC Curve

ViT ROC Curve

Sample Predictions

ViT Predictions



📊 CNN vs Vision Transformer (Physics-Aware Comparison)

Conceptual Comparison

Aspect CNN (VGG16) ViT


Feature focus Local Global Physics analogy Local energy deposits Event-level topology Noise robustness Moderate High

Performance & Behavior

Criterion CNN (VGG16) ViT-B/32
Training stability High Medium
Muon classification ⭐⭐⭐⭐⭐ ⭐⭐⭐⭐⭐
Electron classification ⭐⭐⭐⭐ ⭐⭐⭐⭐⭐
Hadron classification ⭐⭐⭐ ⭐⭐⭐⭐
Generalization Moderate Strong

Interpretation

  • CNNs excel at localized structures (tracks, compact showers)
  • ViTs excel at global reasoning (hadronic fragmentation)

🔁 Role of Diffusion in Classification

Diffusion-based augmentation: - Increases sample diversity - Reduces overfitting - Improves electron and hadron recognition

Diffusion augments, not replaces, physics simulation.


📦 Dependencies

torch
torchvision
diffusers
numpy
scikit-learn
matplotlib
seaborn
tqdm

🚀 Applications

  • Particle identification
  • Detector response modeling
  • HEP ML research
  • Data augmentation studies

👤 Author

Anurag G.C.
Computer Engineering
IOE Pulchowk Campus
Nepal 🇳🇵

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published