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 · DOI

TL;DR

Researchers have developed Flare7K++, a hybrid dataset and end-to-end pipeline designed to solve the messy problem of nighttime lens flares. By mixing 7,000 sophisticated synthetic flares with 962 real-world captures, the authors created a system that removes distracting streaks and halos while precisely preserving the original light sources—a critical requirement for autonomous driving and nighttime photography.

What Problem Does This Paper Address?

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 are a different beast. Artificial lights have unique color spectra, and the "gunk" on our lenses—fingerprints, dust, and micro-scratches—creates complex diffraction patterns that are incredibly hard to model mathematically.

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

  1. The Domain Gap: Synthetic datasets don't look "real" enough, especially the messy degradation right around the bulb.
  2. Light Source Erasure: Most algorithms use a simple "threshold" to find light sources. If a light is tiny or not bright enough, the algorithm might accidentally delete the light source along with the flare, or leave behind a "tail" of artifacts.

This isn't just an aesthetic issue; lens flares can trick autonomous driving systems into seeing "ghost" obstacles or cause tracking algorithms to lose their targets.

Methods

The authors propose a two-pronged solution: a better dataset and a smarter training pipeline.

1. The Hybrid Dataset (Flare7K++): Instead of relying solely on math, they combined Flare7K (synthetic flares generated using professional VFX tools like Adobe After Effects) with Flare-R (962 real flares captured in a darkroom using smartphones with deliberately "dirtied" lenses). This mix allows the model to learn the general physics of light from the synthetic data while learning the "messy" reality of lens contaminants from the real data.

2. The End-to-End Pipeline: Previous methods tried to remove the flare and then "paste" the light source back in using a mask. Flare7K++ uses a 6-channel output strategy. The network simultaneously predicts two 3-channel images: one containing only the clean background (with the light source) and one containing only the flare. By supervising both, the model learns to distinguish between the "streak" (which should go) and the "bulb" (which should stay).

Datasets

  • Flare7K (Synthetic): 5,000 scattering flares and 2,000 reflective flares. It breaks flares down into components: glare (haze), shimmer (radial lines), and streak (long stripes).
  • Flare-R (Real): 962 images captured using Huawei P40, iPhone 13 Pro, and ZTE Axon 20 5G. The researchers wiped the lenses with fingers, silk, and cloth to simulate daily wear.
  • Flickr24K: Used as the "clean" background images to which the flares were added for training.

Key Insights and Ideas

  • The "Messy" Middle: The authors found that synthetic flares are great for long streaks but fail to capture the complicated diffraction that happens near the light source. Adding real-captured data (Flare-R) was the "aha moment" that fixed artifacts around the bulbs.
  • Light Source Annotations: This is the first dataset to provide specific labels for the light sources themselves. This allows the network to treat the "source" and the "artifact" as two different entities rather than just trying to "clean" the whole image at once.
  • Downstream Impact: Restoration isn't just for Instagram. The paper demonstrates that removing flares significantly improves the accuracy of stereo matching (depth sensing), optical flow (motion tracking), and semantic segmentation (identifying what objects are).

Key Results

The Flare7K++ approach was tested against several state-of-the-art restoration networks (like U-Net, HINet, and Restormer).

  • Quantitative: On real-world test sets, the proposed method achieved a PSNR of 27.633, significantly higher than previous methods like Wu et al. (24.613).
  • Qualitative: Visual results show a dramatic reduction in "tails" and artifacts around light sources. While older models often left a blurry smudge where a streak met a light bulb, Flare7K++ produces a clean, sharp light source.
  • Robustness: The model generalizes well across different phone cameras and lighting conditions, even when multiple light sources are present in a single frame.

Limitations and Future Work

Despite the progress, some hurdles remain:

  • False Positives: Sometimes the model confuses a bright window or a distant streetlamp with a reflective flare "spot" and tries to remove it.
  • Extreme Saturation: If a flare is so bright that it completely saturates all color channels (clipping), the information is lost forever, and the model cannot perfectly reconstruct what was underneath.
  • Future Directions: The authors suggest that incorporating "semantic priors" (teaching the model what a car or a building should look like) could help it make better decisions in those highly saturated areas.

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},
}

Loading related content...

Figure