Skip to content

LintaoPeng/U-shape_Transformer_for_Underwater_Image_Enhancement

Repository files navigation

U-shape Transformer

arXiv issues forks stars license

This repository is the official PyTorch implementation of U-shape Transformer for Underwater Image Enhancement. (arxiv, Dataset(lsui), video demo, visual results). U-shape Transformer achieves state-of-the-art performance in underwater image enhancement task.


🚀 🚀 🚀 News:

  • 2021/11/25 We released our pretrained model, You can download the pretrain models in BaiduYun with the password tdg9 or in Google Drive.

  • 2021/11/24 We released the official code of U-shape Transformer

  • 2021/11/23 We released LSUI dataset, We released a large-scale underwater image (LSUI) dataset, which involves richer underwater scenes (lighting conditions, water types and target categories) and better visual quality reference images than the existing ones. You can download it from [here](lsui) or GoogleDrive.

    avatar


The light absorption and scattering of underwater impurities lead to poor underwater imaging quality. The existing data-driven based underwater image enhancement (UIE) techniques suffer from the lack of a large-scale dataset containing various underwater scenes and high-fidelity reference images. Besides, the inconsistent attenuation in different color channels and space areas is not fully considered for boosted enhancement. In this work, we constructed a large-scale underwater image (LSUI) dataset , and reported an U-shape Transformer network where the transformer model is for the first time introduced to the UIE task. The U-shape Transformer is integrated with a channel-wise multi-scale feature fusion transformer (CMSFFT) module and a spatial-wise global feature modeling transformer (SGFMT) module, which reinforce the network's attention to the color channels and space areas with more serious attenuation. Meanwhile, in order to further improve the contrast and saturation, a novel loss function combining RGB, LAB and LCH color spaces is designed following the human vision principle. The extensive experiments on available datasets validate the state-of-the-art performance of the reported technique with more than 2dB superiority.

Contents

  1. Training
  2. Testing
  3. Results
  4. Citation
  5. License and Acknowledgement

Training

If you need to train our U-shape transformer from scratch, you need to download our dataset from BaiduYun(password is lsui) or GoogleDrive, and then randomly select 3879 picture pairs as the training set to replace the data folder, and the remaining 400 as the test set to replace the test folder. The dataset divided by the author can be downloaded from BaiduYun(password is lsui).

Then, run the train.ipynb file with Jupiter notebook, and the trained model weight file will be automatically saved in saved_ Models folder. As described in the paper, we recommend you use L2 loss for the first 600 epochs and L1 loss for the last 200 epochs.

Environmental requirements:

  • Python 3.7 or a newer version

  • Pytorch 1.7 0r a newer version

  • CUDA 10.1 or a newer version

  • OpenCV 4.5.3 or a newer version

  • Jupyter Notebook

Or you can install from the requirements.txt using

pip install -r requirements.txt

Testing

For your convenience, we provide some example datasets (~20Mb) in ./test. You can download the pretrain models in BaiduYun with the password tdg9 or in Google Drive.

After downloading, extract the pretrained model into the project folder and replace the ./saved_models folder, and then run test.ipynb. The code will use the pretrained model to automatically process all the images in the ./test/input folder and output the results to the ./test/output folder. In addition, the output result will automatically calculate the PSNR value with the reference image.

Dataset

The LSUI is a large-scale underwater image (LSUI) dataset, which involves richer underwater scenes (lighting conditions, water types and target categories) and better visual quality reference images than the existing ones. You can download it from BaiduYun(password is lsui) or GoogleDrive. If you want to use the LSUI dataset, please cite our [paper]

Results

We achieved state-of-the-art performance on underwater image enhancement task. Detailed results can be found in the paper or our project page

Full-Reference Evaluation (click me)

Non-reference Evaluation

Citation

@ARTICLE{10129222,
  author={Peng, Lintao and Zhu, Chunli and Bian, Liheng},
  journal={IEEE Transactions on Image Processing}, 
  title={U-Shape Transformer for Underwater Image Enhancement}, 
  year={2023},
  volume={32},
  number={},
  pages={3066-3079},
  doi={10.1109/TIP.2023.3276332}}

License and Acknowledgement

This project is released under the MIT license. The codes are designed based on pix2pix. We also refer to codes in UCTransNet and TransBTS. Please also follow their licenses. Thanks for their awesome works.

About

U-shape Transformer for Underwater Image Enhancement

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published