Skip to content

Conversation

@iamsarvrath
Copy link

🚀 Overview

This PR introduces SwinIR (Swin Transformer for Image Restoration) to the DeepLense repository. This contribution implements a state-of-the-art Vision Transformer pipeline to enhance the resolution of strong gravitational lensing images, demonstrating the potential of attention mechanisms for reconstructing fine details in dark matter substructure analysis.

🔬 Scientific Motivation

Traditional CNN-based models often struggle with the global geometry of lensing arcs due to limited receptive fields. This implementation leverages Self-Attention mechanisms to capture long-range dependencies, aiming to provide sharper reconstructions of lensing structures compared to standard convolutional baselines.

✨ Key Features

  • End-to-End Pipeline: Modular scripts for data generation (generate_gsoc_pairs.py), preprocessing, training, and evaluation.
  • Real Data Integration: Incorporates "Model 4" simulation parameters with Galaxy10_DECals real galaxy backgrounds.
  • State-of-the-Art Architecture: Implements Residual Swin Transformer Blocks (RSTB) for deep feature extraction.

📊 Results & Benchmarks

The model was trained for 10 epochs on an NVIDIA GPU, achieving promising results that outperform standard bicubic and CNN baselines.

Model Dataset PSNR (dB) SSIM Status
Bicubic Interpolation Galaxy10 (Sim) ~28.00 ~0.75 Baseline
SRResNet Galaxy10 (Sim) ~31.50 ~0.88 Standard
SwinIR (Ours) Galaxy10 (Sim) 35.66 0.9642 Implemented

🧪 Verification

The PR includes:

  1. Verified generation of 2500 high-quality/low-quality pairs.
  2. Validated training loop convergence.
  3. Evaluation script that generates visual comparisons (results.png).

📷 Visual Proof

A sample result (results.png) is included in the PR to demonstrate the reconstruction quality.


Contributor: Sarvesh Rathod

- Add interactive Jupyter notebooks for data simulation, training, and deployment
- Update README with project development history (Python scripts → notebooks)
- Include performance metrics (PSNR: 44.13 dB, SSIM: 0.9868)
- Update .gitignore to exclude generated files
- Fix duplicate dependency in requirements.txt
@iamsarvrath
Copy link
Author

Add Jupyter notebooks and enhance project documentation

This commit introduces interactive Jupyter notebooks alongside the existing
Python scripts, providing a more accessible and educational workflow for
the SwinIR super-resolution pipeline.

Changes:

  • Add three comprehensive Jupyter notebooks:

    • 01_Advanced_Data_Simulation.ipynb: Interactive gravitational lensing
      simulation with real Galaxy10_DECals sources
    • 02_Advanced_SwinIR_Training.ipynb: Advanced training pipeline with
      multiple presets (TURBO/STANDARD/RESEARCH) and scientific metrics
    • 03_Optimization_and_Deployment.ipynb: Model optimization, pruning,
      quantization, and ONNX export functionality
  • Enhance README.md with comprehensive documentation:

    • Document project development history (Python scripts → notebooks)
    • Include performance metrics (PSNR: 44.13 dB, SSIM: 0.9868)
    • Add detailed usage instructions for both notebook and script workflows
    • Document scientific contributions and project structure
    • Include performance metrics table and assessment
  • Update project configuration:

    • Enhance .gitignore to exclude generated files (results.png, *.onnx)
    • Fix duplicate dependency in requirements.txt

This update maintains backward compatibility with existing Python scripts
while providing an improved interactive experience through notebooks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant