Flare7K: A Phenomenological Nighttime Flare Removal Dataset

Yuekun Dai, Chongyi Li, Shangchen Zhou, Ruicheng Feng, Chen Change Loy

Abstract

Lens flares in nighttime photography significantly degrade image quality and hinder the performance of computer vision tasks such as autonomous driving and stereo matching. While daytime flare removal has been extensively studied, nighttime flares—characterized by diverse artificial light sources and lens defects—remain a challenge. This paper introduces Flare7K, the first large-scale dataset specifically designed for nighttime flare removal. By adopting a phenomenological approach to synthesize 7,000 diverse flare patterns based on real-world lens defects, the authors provide a benchmark that significantly outperforms previous daytime-centric models in restoring nighttime visibility.

Introduction

If you have ever photographed a streetlamp at night, you have likely encountered lens flares: long streaks of light, smooth glares, or ghostly circles across the frame. While sometimes used for artistic effect, flares are a major obstacle for computer vision. They obscure scene details, reduce contrast, and can even induce errors in autonomous systems; for example, a "scattering flare" might be misidentified as a physical obstacle by a stereo-matching algorithm.

Existing research has largely focused on daytime scenes, but nighttime flares are fundamentally different. They are caused by multiple artificial light sources with unique spectra and are often exacerbated by everyday lens "wear and tear," such as fingerprints, dust, and scratches. Previous datasets were either too small, too homogeneous, or relied on physics-based simulations that failed to capture the messy reality of a dirty smartphone lens at night.

The Phenomenological Synthesis Pipeline

The authors move away from purely physics-based simulations, which are computationally expensive and struggle to model random lens defects. Instead, they propose a phenomenological synthesis pipeline. This approach focuses on reproducing the appearance and statistics of real-world flares rather than just the underlying optics.

Nighttime flares are categorized into two main types:

  1. Scattering Flares: Caused by scratches and dust on the lens surface. These are decomposed into three components: glare (the smooth glow), shimmer (radial stripes from the aperture shape), and streaks (long, bright lines from scratches or oil).
  2. Reflective Flares: Caused by internal reflections between lens elements. These appear as "ghosts" or circles that move opposite to the light source.

Using professional tools like Adobe After Effects and specialized plugins (e.g., Optical Flares), the researchers synthesized 7,000 unique flare templates. These templates are randomly augmented—rotated, blurred, and color-shifted—and blended with flare-free background images from the Flickr24K dataset to create realistic training pairs.

The Flare7K Dataset

The resulting Flare7K dataset consists of:

  • 5,000 scattering flare images covering 25 distinct types.
  • 2,000 reflective flare images covering 10 distinct types.
  • Rich Annotations: Unlike previous datasets, Flare7K provides separate masks for the light source, glare, streaks, and reflective components.

To ensure the dataset's efficacy, the authors also collected a Real-world Test Set of 100 pairs. These were captured by taking photos with a "dirty" lens to induce flare, followed by carefully cleaning the lens to capture a "ground truth" flare-free version of the same scene.

Key Insights and Results

The "Dirty Lens" Factor

The paper emphasizes that for consumer hardware like smartphones and dashcams, flares are not just an optical property of the glass but a result of human use. Modeling fingerprints and dust as "gratings" is key to realistic synthesis. This focus on the domain gap explains why models trained on daytime flare datasets perform poorly at night; they fail to account for high-frequency streaks and the specific luminance of artificial lights.

Quantitative Performance

The authors benchmarked several state-of-the-art image restoration models, including HINet, Restormer, and Uformer, on Flare7K.

  • Improvement over Daytime Models: A U-Net trained on Flare7K achieved a PSNR of 26.11 on real-world nighttime data, compared to just 24.61 for the same model trained on previous daytime datasets.
  • Top Performer: The Uformer architecture achieved the best results on the real-world test set, reaching a PSNR of 26.98 and an SSIM of 0.890.
  • Downstream Impact: Applying flare removal as a pre-processing step significantly improved the accuracy of stereo matching (disparity estimation), proving the dataset's utility for autonomous systems.

Limitations and Future Work

Despite its success, Flare7K faces remaining hurdles. Semantic Confusion occurs when reflective flares (bright spots) look identical to distant windows or streetlights, leading models to accidentally remove actual scene elements. Furthermore, Extreme Saturation remains a problem; when a flare completely saturates the sensor, the underlying information is lost, and current models struggle to "hallucinate" the missing details.

The authors suggest that incorporating semantic priors—helping the model understand the difference between a lamp and a flare—could further reduce false positives in the removal process.

Summary updated

BibTeX
@inproceedings{dai2022flare,
  author = {Yuekun Dai and Chongyi Li and Shangchen Zhou and Ruicheng Feng and Chen Change Loy},
  title = {{Flare7K: A Phenomenological Nighttime Flare Removal Dataset}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
}
Figure