Flare7K++: Mixing Synthetic and Real Datasets for Nighttime Flare Removal and Beyond

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

Abstract

Artificial lights commonly leave strong lens flare artifacts on the images captured at night, degrading both the visual quality and performance of vision algorithms. Existing flare removal approaches mainly focus on removing daytime flares and fail in nighttime cases. Nighttime flare removal is challenging due to the unique luminance and spectrum of artificial lights, as well as the diverse patterns and image degradation of the flares. The scarcity of the nighttime flare removal dataset constraints the research on this crucial task. In this paper, we introduce Flare7K++, the first comprehensive nighttime flare removal dataset, consisting of 962 real-captured flare images (Flare-R) and 7,000 synthetic flares (Flare7K). Compared to Flare7K, Flare7K++ is particularly effective in eliminating complicated degradation around the light source, which is intractable by using synthetic flares alone. Besides, the previous flare removal pipeline relies on the manual threshold and blur kernel settings to extract light sources, which may fail when the light sources are tiny or not overexposed. To address this issue, we additionally provide the annotations of light sources in Flare7K++ and propose a new end-to-end pipeline to preserve the light source while removing lens flares. Our dataset and pipeline offer a valuable foundation and benchmark for future investigations into nighttime flare removal studies. Extensive experiments demonstrate that Flare7K++ supplements the diversity of existing flare datasets and pushes the frontier of nighttime flare removal towards real-world scenarios.

The Challenge of Nighttime Lens Flare

If you’ve ever taken a photo of a streetlamp at night, you’ve seen lens flare: those radial streaks (scattering flares) and ghostly polygons (reflective flares) that wash out details. While daytime flare removal is a well-studied area, nighttime flares present unique challenges. Artificial lights have distinct color spectra, and lens contaminants—such as fingerprints, dust, and micro-scratches—create complex diffraction patterns that are difficult to model mathematically.

Existing flare removal tools often struggle at night for two primary reasons:

  1. The Domain Gap: Synthetic datasets often lack the realism required to model the messy degradation immediately surrounding a light source.
  2. Light Source Erasure: Most algorithms rely on simple thresholds to identify light sources. If a light is small or not sufficiently overexposed, the algorithm may inadvertently delete the light source along with the flare, or leave behind artifact "tails."

This is not merely an aesthetic concern; lens flares can significantly impact autonomous driving systems by creating "ghost" obstacles or causing tracking algorithms to fail.

Methodology: A Hybrid Approach

The researchers propose a two-pronged solution involving a superior dataset and a more intelligent training pipeline.

The Hybrid Dataset (Flare7K++)

Instead of relying solely on mathematical modeling, the authors combined Flare7K (7,000 synthetic flares generated using professional VFX tools) with Flare-R (962 real flares captured in a darkroom using various smartphones with deliberately contaminated lenses). This mixture allows the model to learn the general physics of light from synthetic data while capturing the "messy" reality of lens contaminants from real-world captures.

The End-to-End Pipeline

Previous methods often attempted to remove the flare and then "paste" the light source back in using a mask. Flare7K++ introduces a 6-channel output strategy. The network simultaneously predicts two 3-channel images: one containing the clean background (including the light source) and another containing only the flare. By supervising both outputs, the model learns to distinguish between the artifact (the flare) and the intended subject (the light source).

Dataset Composition

The Flare7K++ dataset is composed of three primary elements:

  • Flare7K (Synthetic): Includes 5,000 scattering flares and 2,000 reflective flares, decomposed into components like glare (haze), shimmer (radial lines), and streak (long stripes).
  • Flare-R (Real): 962 images captured using devices like the Huawei P40 and iPhone 13 Pro. Lenses were wiped with fingers, silk, and cloth to simulate daily wear and tear.
  • Flickr24K: Serves as the "clean" background images to which flares are added for training purposes.
Examples of scattering and reflective flares across synthetic (Flare7K) and real (Flare-R) domains.

Key Insights

  • Addressing the "Messy" Middle: Synthetic flares are effective for long streaks but often fail to capture the complex diffraction near the light source. The inclusion of Flare-R data was critical in fixing artifacts around the bulbs.
  • Light Source Annotations: Flare7K++ is the first dataset to provide specific labels for light sources, allowing the network to treat the source and the artifact as distinct entities.
  • Downstream Impact: Beyond visual restoration, removing flares improves the accuracy of computer vision tasks such as stereo matching (depth sensing), optical flow (motion tracking), and semantic segmentation.

Results and Performance

The Flare7K++ approach was benchmarked against state-of-the-art restoration networks, including U-Net and Restormer.

  • Quantitative Results: On real-world test sets, the proposed method achieved a PSNR of 27.633, significantly outperforming previous benchmarks like Wu et al. (24.613).
  • Qualitative Results: Visual inspections show a dramatic reduction in "tails" and artifacts. While older models often leave a blurry smudge where a streak meets a light bulb, Flare7K++ produces a clean, sharp light source.
Qualitative comparison of flare removal. Flare7K++ (d) demonstrates superior artifact removal and light source preservation compared to the input (a) and previous methods (b, c).

Limitations and Future Work

Despite these advancements, some challenges remain. The model can occasionally confuse bright windows or distant lamps with reflective flare spots, leading to false positives. Additionally, in cases of extreme saturation where color channels are clipped, information is lost, making perfect reconstruction impossible. Future research may involve incorporating "semantic priors" to help the model make better decisions in these highly saturated regions.

Summary updated

BibTeX
@article{dai2024flare,
  author = {Yuekun Dai and Chongyi Li and Shangchen Zhou and Ruicheng Feng and Yihang Luo and Chen Change Loy},
  title = {{Flare7K++: Mixing Synthetic and Real Datasets for Nighttime Flare Removal and Beyond}},
  journal = {IEEE Trans. Pattern Anal. Mach. Intell.},
  year = {2024},
  doi = {10.1109/tpami.2024.3406821},
}
Figure