Skip to content

Latest commit

 

History

35 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HyMPOR β€” Hybrid Multi-Stage Pipeline for Restoring Damaged and Occluded Old Photographs

Status Python PyTorch License


Open in Colab

πŸ“– Abstract

Old photographs suffer from complex, co-occurring degradations β€” scratches, stains, fading, occlusions, and loss of fine detail β€” that no single restoration model can adequately address. We present HyMPOR, a hybrid multi-stage pipeline that sequentially applies state-of-the-art models for scratch detection and removal, face enhancement, object removal via segmentation-guided inpainting, and colorization. Evaluated on both synthetic and real damaged photographs, HyMPOR achieves superior quantitative scores and perceptually compelling results across all degradation types.


HyMPOR Pipeline

πŸš€ Quick Start

Everything runs in Google Colab β€” no manual setup, no separate weight downloads.

  1. Click the Open in Colab badge above.
  2. Set the runtime to GPU: Runtime β–Έ Change runtime type β–Έ T4 GPU.
  3. Run the first cell. It automatically downloads the complete project (code + all pre-trained weights) from the latest Release and extracts it.
  4. Run the remaining cells in order to restore your photo.

The full project (~10 GB) is split into parts in the Release and reassembled automatically by the first cell. The first run takes 10–20 minutes depending on connection speed; afterwards everything is cached for the session.


πŸ—οΈ Pipeline Architecture

Input (Damaged Old Photo)
        β”‚
        β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Stage 1 β€” Scratch & Damage Removal β”‚  ← Bringing Old Photos Back to Life
β”‚  Global restoration + face detectionβ”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚
                  β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Stage 2 β€” Object / Occlusion       β”‚  ← SAM2 + AOT-GAN
β”‚  Segmentation β†’ Inpainting          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚
                  β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Stage 3 β€” Face Enhancement         β”‚  ← GFPGAN
β”‚  Blind face restoration via GAN     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚
                  β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Stage 4 β€” Colorization             β”‚  ← DeOldify
β”‚  Self-attention GAN colorization    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                  β”‚
                  β–Ό
        Output (Restored Photo)

πŸ”„ Switching GFPGAN Versions

The project bundles both GFPGAN face-enhancement weights β€” v1.4 (default) and v1.3. You can switch between them by editing a single line in the GFPGAN cell (Step 3):

# Default β€” v1.4
GFPGAN_WEIGHTS = f'{GFPGAN_DIR}/experiments/pretrained_models/GFPGANv1.4.pth'

# To use v1.3 instead, change 1.4 β†’ 1.3:
GFPGAN_WEIGHTS = f'{GFPGAN_DIR}/experiments/pretrained_models/GFPGANv1.3.pth'

Both weights are included in the project, so no extra download is needed β€” just change the number and re-run the cell.


🧩 Modules

# Module Purpose Official Repo
1 Bringing Old Photos Back to Life Scratch detection & global restoration microsoft/Bringing-Old-Photos-Back-to-Life
2 SAM2 Object segmentation & mask generation facebookresearch/sam2
3 AOT-GAN Inpainting of segmented regions researchmm/AOT-GAN-for-Inpainting
4 GFPGAN Blind face enhancement TencentARC/GFPGAN
5 DeOldify Automatic colorization jantic/DeOldify

βœ… All pre-trained weights are bundled in the Release and downloaded automatically by the notebook. There is nothing to download or place manually.


πŸ“‚ Repository Structure

HyMPOR/
β”œβ”€β”€ HyMPOR_GitHub.ipynb         # Main Colab notebook β€” start here
β”œβ”€β”€ pipeline/                   # Core pipeline code
β”‚   β”œβ”€β”€ run.py                  # Orchestrator (SAM2 β†’ selector β†’ AOT-GAN)
β”‚   β”œβ”€β”€ config.py               # Central configuration
β”‚   β”œβ”€β”€ segmentation.py         # SAM2 segmentation
β”‚   β”œβ”€β”€ inpainting.py           # AOT-GAN inpainting
β”‚   └── selector.py             # Content-aware weight selector
β”‚
└── modules/
    β”œβ”€β”€ Bringing_Old_Photos_Back_to_Life/   # Stage 1
    β”œβ”€β”€ SAM2/                               # Stage 2a
    β”œβ”€β”€ AOT_GAN/                            # Stage 2b
    β”œβ”€β”€ GFPGAN/                             # Stage 3
    └── DeOldify/                           # Stage 4

πŸ“Š Evaluation Metrics

Metric Type Range Better
PSNR Pixel-level fidelity dB ↑ Higher
SSIM Structural similarity [0, 1] ↑ Higher
LPIPS Perceptual quality [0, 1] ↓ Lower
BRISQUE No-reference quality (spatial) [0, 100] ↓ Lower
MANIQA No-reference quality (transformer) [0, 1] ↑ Higher

πŸ“„ Citation

If you find this work useful, please cite:

@article{HyMPOR2026,
  title   = {A Hybrid Multi-Stage Pipeline for Restoring Damaged and Occluded Old Photographs},
  author  = {Anas Hameed Ali},
  journal = {Under Review},
  year    = {2026}
}

πŸ™ Acknowledgements

This work builds upon several outstanding open-source projects:


πŸ“¬ Contact

For questions or collaborations, please open an issue.

πŸ“œ License

Released under the MIT License.

About

A Hybrid Multi-Stage Pipeline for Restoring Damaged and Occluded Old Photographs

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages