# Region-Adaptive Low-Light Image Enhancement with Light Effect Suppression and Detail Preservation

This repository contains the official PyTorch implementation of our paper "Region-Adaptive Low-Light Image Enhancement with Light Effect Suppression and Detail Preservation".

## Overview

We propose a novel region-adaptive framework for low-light image enhancement that effectively handles both underexposed dark regions and overexposed bright regions while preserving fine details. Our method consists of:

- Region segmentation module for adaptive enhancement
- Light effect suppression mechanism for bright regions 
- Detail preservation with structural consistency

## Framework
![framework](assets/framework.png)

## Requirements

Create conda environment:
```sh
conda env create -f environment.yml
conda activate LLIE
```

Key dependencies:
- Python 3.9 
- PyTorch 1.13.1
- torchvision 0.14.1
- pyiqa 0.1.13 
- PIL
- numpy
- matplotlib

## Usage

### Training
```sh
bash script/train.sh
```

Training configurations can be modified in `train.sh`:
- `--batch_size`: Batch size (default: 1)
- `--epochs`: Number of epochs (default: 2001) 
- `--lr`: Learning rate (default: 0.0002)
- `--train_low_data_names`: Training data path
- `--test_low_data_names`: Test data path

### Testing
Place test images in `data/example/` and run:
```sh
python train.py --test_low_data_names './data/example'
```

## Model Architecture

### Network Components
- **Region Segmentation Module**: Analyzes and segments image into dark/bright regions
- **Adaptive Enhancer**: Region-specific enhancement strategies
- **Light Effect Suppressor**: Handles overexposed areas with light suppression
- **Detail Preservation**: Maintains structural consistency and high-frequency details

### Loss Functions
- Enhancement loss
- Light effect suppression loss 
- Structural consistency loss
- High-frequency detail loss
- Region transition smoothness loss

## Results

### Qualitative Results
![results](assets/results.png)
