{"id":25440002,"url":"https://github.com/ddz16/uiedp","last_synced_at":"2025-05-15T12:32:24.004Z","repository":{"id":277077887,"uuid":"724509529","full_name":"ddz16/UIEDP","owner":"ddz16","description":"This repository provides offical Pytorch implementation of the paper \"UIEDP: Boosting underwater image enhancement with diffusion prior\".","archived":false,"fork":false,"pushed_at":"2025-02-12T01:33:13.000Z","size":21726,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-12T02:37:13.667Z","etag":null,"topics":["diffusion-models","image-processing","underwater-image-enhancement","underwater-image-restoration","underwater-images"],"latest_commit_sha":null,"homepage":"https://www.sciencedirect.com/science/article/abs/pii/S0957417424021389","language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ddz16.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-11-28T08:18:56.000Z","updated_at":"2025-02-12T01:35:34.000Z","dependencies_parsed_at":"2025-02-12T04:46:04.800Z","dependency_job_id":null,"html_url":"https://github.com/ddz16/UIEDP","commit_stats":null,"previous_names":["ddz16/uiedp"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddz16%2FUIEDP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddz16%2FUIEDP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddz16%2FUIEDP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ddz16%2FUIEDP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ddz16","download_url":"https://codeload.github.com/ddz16/UIEDP/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254341344,"owners_count":22055020,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["diffusion-models","image-processing","underwater-image-enhancement","underwater-image-restoration","underwater-images"],"created_at":"2025-02-17T11:19:54.124Z","updated_at":"2025-05-15T12:32:23.948Z","avatar_url":"https://github.com/ddz16.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UIEDP\n\nThis repository provides offical Pytorch implementation of the paper \"[UIEDP: Boosting underwater image enhancement with diffusion prior](https://www.sciencedirect.com/science/article/abs/pii/S0957417424021389)\".\n\n\n\n\n## Environment\n\n```\nconda create -n uiedp python=3.9\nconda activate uiedp\n\npip install torch==1.13.0+cu117 torchvision==0.14.0+cu117 torchaudio==0.13.0 -f https://download.pytorch.org/whl/torch_stable.html\n\npip install tb_nightly==2.14.0a20230808 -i https://mirrors.aliyun.com/pypi/simple\n\npip install pyiqa\n\npip install blobfile\n\npip install mpi4py\n```\n\n## Pretrained Diffusion Model\nYou can download [the pretrained diffusion model](https://openaipublic.blob.core.windows.net/diffusion/jul-2021/256x256_diffusion_uncond.pt) provided by OpenAI. Then put it in the `./models/` folder.\n\n## Prepare Data\nYou need to download the raw images and pseudo-label images of three test datasets (T90|C60|U45) from [Baidu Netdisk](https://pan.baidu.com/s/1nZI734Hauh6ze3J_JgCY3Q?pwd=data), and the passward is 'data'. Then unzip the `data.zip` archive in the `./data/` folder:\n```\nunzip ./data/data.zip -d ./data/\n```\nThen you can obtain the following folder structure:\n```\n./data/\n├── pseudo_label\n│   ├── C60/\n│   ├── T90/\n│   └── U45/\n├── raw\n│   ├── C60/\n│   ├── T90/\n│   └── U45/\n└── reference\n    └── T90/\n```\n+ The subfolder `pseudo_label/` contains the pseudo-label images of T90|C60|U45 datasets generated by pretrained [UIEC2Net](https://github.com/ddz16/UIE_Benckmark). Here we utilize UIEC2Net as the UIE algorithm which generates pseudo-label images in UIEDP. If you want to use any other UIE algorithm, please put its enhanced results in the `pseudo_label/` folder, just like above.\n\n+ The subfolder `raw/` contains the raw images of T90|C60|U45 datasets.\n\n+ The subfolder `reference/` contains the reference images of T90 dataset, because C60 and U45 have no reference images.\n\n## Conditional Generation\nYou can directly run the script:\n```\nsh run_ddpm.sh\n```\nthe script contains:\n```\nSAMPLE_FLAGS=\"--batch_size 8\"\nMODEL_FLAGS=\"--attention_resolutions 32,16,8 --class_cond False --diffusion_steps 1000 --image_size 256 --learn_sigma True --noise_schedule linear --num_channels 256 --num_head_channels 64 --num_res_blocks 2 --resblock_updown True --use_fp16 True --use_scale_shift_norm True\"\nCUDA_VISIBLE_DEVICES=0 python uie_sample.py $MODEL_FLAGS --uie_dataset U45 --classifier_scale 4000.0 --model_path models/256x256_diffusion_uncond.pt $SAMPLE_FLAGS\n```\nYou can change the dataset into one of T90|C60|U45, and change the classifier_scale (guidance scale).\nThe generated enhanced images are saved in the `./data/UIEDP/T90|C60|U45/` folder.\n\n## Evaluation\nAfter sampling, you can evaluate perfermance of any dataset:\n```\npython uie_test.py --dataset T90|C60|U45\n```\n\n## Acknowledgment\nWe adapted the code of [guided-diffusion](https://github.com/openai/guided-diffusion/tree/main) and [GDP](https://github.com/Fayeben/GenerativeDiffusionPrior). Thanks to the original authors for their work! \n\n## Citation\n\n```\n@article{du2025uiedp,\n  title={UIEDP: Boosting underwater image enhancement with diffusion prior},\n  author={Du, Dazhao and Li, Enhan and Si, Lingyu and Zhai, Wenlong and Xu, Fanjiang and Niu, Jianwei and Sun, Fuchun},\n  journal={Expert Systems with Applications},\n  volume={259},\n  pages={125271},\n  year={2025},\n  publisher={Elsevier}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fddz16%2Fuiedp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fddz16%2Fuiedp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fddz16%2Fuiedp/lists"}