CAPformer: Compression-Aware Pre-trained Transformer for Low-Light Image Enhancement

Wei Wang, Zhi JinarXiv 2024 · DOI

Abstract

Low-light image enhancement (LLIE) is a critical task for mobile photography, yet most existing methods fail to account for the JPEG compression artifacts inherent in real-world smartphone images. We present CAPformer (Compression-Aware Pre-trained Transformer), a novel framework that integrates a two-stage training strategy with a Brightness-Guided Self-Attention (BGSA) mechanism. CAPformer effectively restores lost textures and suppresses artifacts common in compressed dark scenes, outperforming state-of-the-art models in both quantitative metrics and visual quality while maintaining a lightweight architecture.

Introduction: The Challenge of Compressed Shadows

While recent advancements in Low-Light Image Enhancement (LLIE) have produced impressive results, they often rely on the assumption of high-quality, uncompressed input data. In reality, mobile devices immediately compress photos into JPEG format to optimize storage. This process is particularly damaging to dark scenes; because pixel values in shadows are low, the quantization step in JPEG compression often obliterates subtle textures or introduces blocky artifacts.

When standard enhancement algorithms attempt to brighten these images, they inadvertently amplify these compression artifacts and noise. This leads to "mushy" textures, severe color shifts, and checkerboard patterns that degrade visual quality. CAPformer is designed to bridge this gap by explicitly accounting for compression during the enhancement process.

The CAPformer Architecture

CAPformer utilizes a hierarchical U-shaped Transformer architecture to capture multi-scale features. This structure allows the model to leverage long-range dependencies, using cleaner, distant parts of an image to help reconstruct heavily damaged dark regions.

Brightness-Guided Self-Attention (BGSA)

A core innovation of CAPformer is the Brightness-Guided Self-Attention (BGSA) mechanism. Standard self-attention can propagate "bad" information from extremely dark, noisy patches across the entire feature map. BGSA mitigates this by calculating a brightness map and applying a threshold to identify regions of extreme darkness. It then strategically guides the model to disregard low-quality information from these regions, focusing instead on more reliable data to inform the reconstruction.

Two-Stage Training Strategy

To decouple the tasks of artifact removal and illumination enhancement, CAPformer employs a two-stage training approach:

  1. Pre-training for Decompression: The model is first trained to restore compressed low-light images back to their uncompressed low-light counterparts. This stage teaches the network specifically how to identify and undo JPEG-induced damage.
  2. Fine-tuning for Enhancement: The pre-trained model is then fine-tuned to perform the final enhancement, transforming the cleaned low-light images into bright, normal-light versions.

Experimental Results

CAPformer was evaluated on three major LLIE benchmarks modified with JPEG compression: LOLv1-JPEG, LOLv2-Real-JPEG, and LOLv2-Synthetic-JPEG.

Quantitative Performance

CAPformer consistently outperformed existing state-of-the-art (SOTA) methods, including SNR, Restormer, and Retinexformer. On the LOLv1-JPEG dataset, CAPformer achieved a PSNR of 23.49 dB, a significant improvement over Retinexformer (22.75 dB) and SNR (22.20 dB).

Qualitative Analysis

Visual comparisons demonstrate CAPformer's ability to produce cleaner textures and superior color consistency. Unlike competing models that often leave behind "checkerboard" artifacts or muddy shadows when processing compressed inputs, CAPformer recovers sharp edges and realistic details.

Visual comparison of CAPformer against SNR on compressed and uncompressed low-light images.

Efficiency

Despite its superior performance, CAPformer remains computationally efficient. With only 8.77 million parameters, it is significantly more lightweight than many competing models, such as HWMNet (66.56M) or SNR (39.13M), making it a viable candidate for mobile deployment.

Conclusion

CAPformer demonstrates that a compression-aware approach is essential for practical low-light image enhancement. By combining a specialized attention mechanism with a two-stage training strategy, it effectively handles the artifacts that plague mobile photography. Future research may explore the model's performance under extreme compression and its adaptability to other modern image formats like HEIC or WebP.

Summary updated

BibTeX
@misc{wang2024capformer,
  author = {Wei Wang and Zhi Jin},
  title = {{CAPformer: Compression-Aware Pre-trained Transformer for Low-Light Image Enhancement}},
  year = {2024},
  eprint = {2407.07056},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2407.07056},
}
Figure