Home

Awesome

Underwater Image Enhancement Baselines

This repository provides implementation of some underwater image enhancement methods and datasets, including:

Supported Methods

MethodPubLanguagePaperReference Codes
Fusion2012 CVPRMATLABEnhancing Underwater Images and Videos by FusionFusion
UWCNN2020 PRPytorchUnderwater Scene Prior Inspired Deep Underwater Image and Video EnhancementUWCNN
UIEC2Net2021 SPICPytorchUIEC^2-Net: CNN-based Underwater Image Enhancement Using Two Color SpaceUIEC2Net
MLLE2022 TIPMATLABUnderwater Image Enhancement via Minimal Color Loss and Locally Adaptive Contrast EnhancementMLLE
UTrans2023 TIPPytorchU-Shape Transformer for Underwater Image EnhancementUTrans
NU2Net2023 AAAIPytorchUnderwater Ranker: Learn Which Is Better and How to Be BetterNU2Net
FiveAPlus2023 BMVCPytorchFive A+ Network: You Only Need 9K Parameters for Underwater Image EnhancementFiveAPlus

Supported Datasets

DatasetLink
UIEBhttps://li-chongyi.github.io/proj_benchmark.html
U45https://github.com/IPNUISTlegal/underwater-test-dataset-U45-
LSUIhttps://github.com/LintaoPeng/U-shape_Transformer_for_Underwater_Image_Enhancement

Environment

conda create -n uie python=3.9
conda activate uie

pip install torch==1.13.0+cu117 torchvision==0.14.0+cu117 torchaudio==0.13.0 -f https://download.pytorch.org/whl/torch_stable.html

pip install pyiqa

pip install pytorch_lightning==2.0.9.post0

Prepare Data

Download the UIEB dataset in the ./data/UIEB/ folder, then you have three subfolders raw-890/, reference-890/, challenging-60/, just like:

./data/UIEB/
├── challenging-60/
├── challenging.txt
├── raw-890/
├── reference-890/
├── test.txt
└── train.txt

Download the LSUI dataset in the ./data/LSUI/ folder, then you have two subfolders GT/, input/, just like:

./data/LSUI/
├── GT/
├── input/
├── test.txt
└── train.txt

Train

Train on the training set of UIEB dataset:

python train_UIEB.py --model_name UIEC2Net --batch_size 16 --epochs 100

We provide four models' checkpoints trained on UIEB dataset in the ./checkpoints/UIEB/ folder:

./checkpoints/UIEB/
├── FIVE_APLUS.ckpt
├── NU2Net.ckpt
├── UIEC2Net.ckpt
└── UWCNN.ckpt

Test

After training, you can enhance the images in the test set and challenging set of UIEB dataset:

python test_UIEB.py --model_name UIEC2Net

The generated enhanced images are saved in the ./data/UIEB/All_Results/ folder. The folder's structure is like:

./data/UIEB/All_Results/
├── FIVE_APLUSNet
│   ├── C60/
│   └── T90/
├── NU2Net
│   ├── C60/
│   └── T90/
├── UIEC2Net
│   ├── C60/
│   └── T90/
├── UTrans
│   ├── C60/
│   └── T90/
└── UWCNN
    ├── C60/
    └── T90/

Each subfolder corresponds to the results of one method.

Evaluation

After testing, you can evaluate any method's perfermance on the test set of UIEB dataset:

python evaluate_UIEB.py --method_name UIEC2Net --folder T90

or you can evaluate perfermance on the challenging set of UIEB dataset:

python evaluate_UIEB.py --method_name UIEC2Net --folder C60

Citation

@article{du2023uiedp,
  title={UIEDP: Underwater Image Enhancement with Diffusion Prior},
  author={Du, Dazhao and Li, Enhan and Si, Lingyu and Xu, Fanjiang and Niu, Jianwei and Sun, Fuchun},
  journal={arXiv preprint arXiv:2312.06240},
  year={2023}
}