--- license: mit pipeline_tag: image-to-image tags: - super-resolution - real-esrgan - swinir - pytorch --- # NPPE3 Super Resolution - Hybrid Ensemble ## Overview This repository contains the trained weights for a high-performance Super Resolution ensemble used in the NPPE3 competition. The solution achieved a **98.1% grading equivalent (39.50+ dB)** by combining the local geometric edge-detection of a Pure CNN with the global texture-reconstruction of a Transformer. ## Models Included in this Repository 1. **`best_realesrnet.pth` (The Architect)** - **Architecture:** RRDBNet (Residual-in-Residual Dense Block) - **Training:** 90 Epochs using Charbonnier Loss and FP16 Mixed Precision. - **Purpose:** Acts as a hardcore edge-detector to perfectly reconstruct geometric boundaries. 2. **`best_swinir.pth` (The Painter)** - **Architecture:** SwinIR-Medium (Swin Transformer) - **Purpose:** Uses self-attention to flawlessly reconstruct repeating global textures (fabric, grass, etc.) that CNNs typically over-smooth. ## The Ensemble Strategy To achieve the final Kaggle Leaderboard score, the predictions from these two architectures were mathematically blended using a **75% RealESRNet / 25% SwinIR** ratio. This specific weighting ensures maximum edge preservation while injecting just enough Transformer attention to patch localized texture blind spots. ## Validation Results (Competition Metric-Style PSNR) - **RealESRNet (Validation Set):** 39.58 dB - **SwinIR (Validation Set):** 39.47 dB - **Final 75/25 Ensemble (Kaggle Leaderboard):** 39.501 dB ## Files - `best_realesrnet.pth` — best RealESRNet checkpoint (state_dict) - `best_swinir.pth` — best SwinIR-Medium checkpoint (state_dict) ## Usage ```python import torch from model import RRDBNet # see Kaggle notebook for the class definition # Initialize the RealESRNet Architecture model = RRDBNet(num_in_ch=3, num_out_ch=3, num_feat=64, num_block=23, num_grow_ch=32) # Load the golden weights ckpt = torch.load("best_realesrnet.pth", map_location="cpu") model.load_state_dict(ckpt['params_ema'] if 'params_ema' in ckpt else ckpt, strict=True) model.eval()