{"id":25999934,"url":"https://github.com/jinyeying/nighttime_dehaze","last_synced_at":"2025-03-05T18:42:17.326Z","repository":{"id":184545104,"uuid":"672080089","full_name":"jinyeying/nighttime_dehaze","owner":"jinyeying","description":"[ACMMM2023] \"Enhancing Visibility in Nighttime Haze Images Using Guided APSF and Gradient Adaptive Convolution\", https://arxiv.org/abs/2308.01738","archived":false,"fork":false,"pushed_at":"2024-07-30T03:44:14.000Z","size":47539,"stargazers_count":141,"open_issues_count":3,"forks_count":10,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-07-30T15:32:47.624Z","etag":null,"topics":["deep-learning","fog","fog-removal","glare","glow","haze","haze-removal","image-enhancement","light-effects","low-level-vision","low-light","low-light-enhance","low-light-image-enhancement","night","night-images","nighttime","nighttime-enhancement","nighttime-images","nighttime-lights","restoration"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"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/jinyeying.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-07-28T21:48:28.000Z","updated_at":"2024-07-30T03:44:17.000Z","dependencies_parsed_at":"2024-06-02T08:48:46.763Z","dependency_job_id":null,"html_url":"https://github.com/jinyeying/nighttime_dehaze","commit_stats":null,"previous_names":["jinyeying/nighttime_dehaze"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jinyeying%2Fnighttime_dehaze","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jinyeying%2Fnighttime_dehaze/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jinyeying%2Fnighttime_dehaze/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jinyeying%2Fnighttime_dehaze/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jinyeying","download_url":"https://codeload.github.com/jinyeying/nighttime_dehaze/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242083069,"owners_count":20069236,"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":["deep-learning","fog","fog-removal","glare","glow","haze","haze-removal","image-enhancement","light-effects","low-level-vision","low-light","low-light-enhance","low-light-image-enhancement","night","night-images","nighttime","nighttime-enhancement","nighttime-images","nighttime-lights","restoration"],"created_at":"2025-03-05T18:40:50.075Z","updated_at":"2025-03-05T18:42:17.321Z","avatar_url":"https://github.com/jinyeying.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# nighttime_dehaze (ACMMM'2023)\n\n## Introduction\n\u003e [Enhancing Visibility in Nighttime Haze Images Using Guided APSF and Gradient Adaptive Convolution](https://arxiv.org/abs/2308.01738)\\\n\u003e ACM International Conference on Multimedia (`ACMMM2023`)\\\n\u003e[Yeying Jin](https://jinyeying.github.io/), [Beibei Lin](https://bb12346.github.io/), Wending Yan, Yuan Yuan, Wei Ye, and [Robby T. Tan](https://tanrobby.github.io/pub.html)\n\n\u003e[![arXiv](https://img.shields.io/badge/arXiv-Paper-\u003cCOLOR\u003e.svg)](https://arxiv.org/abs/2308.01738)\n\u003e[[Paper]](https://dl.acm.org/doi/10.1145/3581783.3611884)\n\n## Prerequisites\n```\ngit clone https://github.com/jinyeying/nighttime_dehaze.git\ncd nighttime_dehaze/\nconda create -n dehaze python=3.7\nconda activate dehaze\nconda install pytorch=1.10.2 torchvision torchaudio cudatoolkit=11.3 -c pytorch\npython3 -m pip install scipy==1.7.3\npython3 -m pip install opencv-python==4.4.0.46\n```\n\n## Nighttime Haze Data\n| Data                | Dropbox                                                                             | BaiduPan                                                                     | Number \u0026 Type|\n| :-----------------: | :---------------------------------------------------------------------------------: | :--------------------------------------------------------------------------: |:-----: | \n|RealNightHaze        |[Dropbox](https://www.dropbox.com/sh/7qzmb3y9akejape/AABYf2ZAqn_5vmPsOPg7KqoMa?dl=0) |[BaiduPan](https://pan.baidu.com/s/11NFB-XXT4SEZcz0eFEajbg?pwd=r5mi) code:r5mi|443, Haze|\n|Internet_night_clean1|[Dropbox](https://www.dropbox.com/sh/izex781w18efhqm/AACu8RJsyRVGNOVVTt3X-0HDa?dl=0) |[BaiduPan](https://pan.baidu.com/s/1km6GO_RPI3jVBlpAZECi0g?pwd=m7k1) code:m7k1|411, Clean Reference|\n|Internet_night_clean2|[Dropbox](https://www.dropbox.com/sh/yj0jac9alsfrxzx/AACsDWYljCjHuFAQ4X1HCNcva?dl=0) |[BaiduPan](https://pan.baidu.com/s/1_Vt5T3m04xqvM9WiKMRuXw?pwd=8f13) code:8f13|50, Clean Reference|\n|GTA5 nighttime fog   |[Dropbox](https://www.dropbox.com/sh/gfw44ttcu5czrbg/AACr2GZWvAdwYPV0wgs7s00xa?dl=0) |[BaiduPan](https://pan.baidu.com/s/1hW9wfVhvYbRaUdHbozOPbw?pwd=67ml) code:67ml|Train:787,Test:77, Synthetic|\n\nSynthetic Nighttime Haze and Clean Ground Truth \n* `ECCV2020`\n*Nighttime Defogging Using High-Low Frequency Decomposition and Grayscale-Color Networks* [[Paper]](https://www.ecva.net/papers/eccv_2020/papers_ECCV/papers/123570460.pdf)\\\nWending Yan, [Robby T. Tan](https://tanrobby.github.io/pub.html) and [Dengxin Dai](https://vas.mpi-inf.mpg.de/)\n\n## Nighttime Dehazing Results [Dropbox](https://www.dropbox.com/sh/itopl02tpv1sda9/AABx1QJVtA9wbPoNVU65r584a?dl=0) | [BaiduPan](https://pan.baidu.com/s/1RpMKNZOAmN9l2s3svsdAFg?pwd=oovt) code:oovt\n| Model  | Dropbox | BaiduPan | Model Put in Path| Results Dropbox | Results BaiduPan |\n| :----: | :-----: | :------: |:---------------: |:--------------: | :--------------: | \n|dehaze.pt|[dehaze.pt](https://www.dropbox.com/scl/fi/y634lpwli4u8dosn0o28r/dehaze.pt?rlkey=lmz1yjlga39somlfr6s0618q8\u0026dl=0)|[dehaze.pt](https://pan.baidu.com/s/1x0Enz-5wXC4Tzm-RXUTmlQ?pwd=n3t8) code:n3t8|[results/dehaze/model](https://github.com/jinyeying/nighttime_dehaze/tree/main/results/dehaze/model)|[RealNightHaze]()|[RealNightHaze](https://pan.baidu.com/s/1LzmygaqvkBtTihJ8sA-amQ?pwd=i43f) code:i43f|\n|GTA5.pt|[GTA5.pt](https://www.dropbox.com/scl/fi/vencyhexni03379iht5yw/GTA5.pt?rlkey=oxsx81g0ds0xk085v2uglkr3t\u0026dl=0)|[GTA5.pt](https://pan.baidu.com/s/1riTgeD1qD09S2Z0Q3niOHw?pwd=fk29) code:fk29|[results/GTA5/model](https://github.com/jinyeying/nighttime_dehaze/tree/main/results/GTA5/model)|[GTA5](https://www.dropbox.com/scl/fo/xik6x6it9f0g5o0n2ng3j/AEBhoSbQ3_z7QSTSSE1G4po?rlkey=mtooznpivfcam7moy9l5skxo8\u0026st=4m470glv\u0026dl=0)|[GTA5](https://pan.baidu.com/s/1diN_A71KJEvlGL0AvlmXDg?pwd=ufen) code:ufen|\n|NHR.pt|[NHR.pt](https://www.dropbox.com/scl/fi/g6gzmjz6eynjqq02lksk0/NHR.pt?rlkey=61o5mck5zrracxoipbdfmmokx\u0026dl=0)|[NHR.pt](https://pan.baidu.com/s/15ejj67FY604Bmr8fjXZADA?pwd=dnhf) code:dnhf|[results/NHR/model](https://github.com/jinyeying/nighttime_dehaze/tree/main/results/NHR/model)|[NHR](https://www.dropbox.com/scl/fo/6w9tuw272ie4gsrxrjjry/ANgjsTO1llXkpwqj2-h7Y-I?rlkey=5pi3kbxkexqatdmfh0sfla9jv\u0026st=dxyaddzl\u0026dl=0)|[NHR](https://pan.baidu.com/s/1lRH6-L4_bEstpa4Opx30Cw?pwd=0nma) code:0nma|\n|NHM.pt|[NHM.pt](https://www.dropbox.com/scl/fi/bncvz68qrhakq0ws2un4w/NHM.pt?rlkey=rowzho61jyn06v2q5gxj8c7jw\u0026dl=0)|[NHM.pt](https://pan.baidu.com/s/1HovU31unlvanTWoEG2hD5g?pwd=d7oj) code:d7oj|[results/NHM/model](https://github.com/jinyeying/nighttime_dehaze/tree/main/results/NHM/model)|[NHM](https://www.dropbox.com/scl/fo/nxxykvzws9my0zea7a8a6/AHnXpO95Lfdao65yPtnQ7hQ?rlkey=z729eo0t41ab1jbepu8qi1iih\u0026st=1afq8q0l\u0026dl=0)|[NHM](https://pan.baidu.com/s/19DAbafWi0IrmDg22XdMTRQ?pwd=4gt0) code：4gt0|\n|NHC.pt|[NHC.pt](https://www.dropbox.com/scl/fi/899sug9o9cwrjdxx61raa/NHC.pt?rlkey=e7vye94mbgut8oicp1yl3kuva\u0026dl=0)|[NHC.pt](https://pan.baidu.com/s/1Tyi7NJ4aMaIaoehh7Hv77g?pwd=yryp) code:yryp|[results/NHC/model](https://github.com/jinyeying/nighttime_dehaze/tree/main/results/NHC/model)|[NHC](https://www.dropbox.com/scl/fo/so9ppeu571zgtoz6gxxpx/ABBkrS8A8nQRKjdCUQr7FU0?rlkey=dn02ite66xu0encwshayhz2ka\u0026st=26d34esu\u0026dl=0)|[NHC](https://pan.baidu.com/s/1nOrVdvMWGpuUjLBhGN3XBA?pwd=njf9) code：njf9|\n\nWe provide the visualization results in `0_ACMMM23_RESULTS/NHR/index.html`, \u003cbr\u003e\ninside the directory `0_ACMMM23_RESULTS/NHR/img_0/` are hazy inputs, `img_1` are ground truths, `img_2` are our results. \u003cbr\u003e\nFor results corresponding to `GTA5`, `NHM` or `NHC`, please refer to the respective directories.\n\n* For the RealNightHaze Dataset\n1. Set the `datasetpath` to `RealNightHaze`,\n2. Download the checkpoint dehaze.pt [Dropbox](https://www.dropbox.com/scl/fi/y634lpwli4u8dosn0o28r/dehaze.pt?rlkey=lmz1yjlga39somlfr6s0618q8\u0026dl=0)| [BaiduPan](https://pan.baidu.com/s/1x0Enz-5wXC4Tzm-RXUTmlQ?pwd=n3t8) code:n3t8 put in [results/dehaze/model](https://github.com/jinyeying/nighttime_dehaze/tree/main/results/dehaze/model),\n3. Run the [Python code](https://github.com/jinyeying/nighttime_dehaze/blob/main/main_test.py), results are in [results/dehaze/output](https://github.com/jinyeying/nighttime_dehaze/tree/main/results/dehaze/output).\n```\nCUDA_VISIBLE_DEVICES=1 python main_test.py --dataset dehaze --datasetpath /diskc/yeying/night_dehaze/dataset/Internet_night_fog/\n```\n\u003cp align=\"left\"\u003e\n  \u003cimg width=\"550\" src=\"teaser/dehaze.png\"\u003e\n\u003c/p\u003e\n\n* For the Synthetic Dataset\n1. Set `Line18 --have_gt` to `True`, set the `datasetpath` to `GTA5` or `NHR` or `NHM` or `NHC`,\n2. Download the checkpoint [GTA5.pt](https://www.dropbox.com/scl/fi/vencyhexni03379iht5yw/GTA5.pt?rlkey=oxsx81g0ds0xk085v2uglkr3t\u0026dl=0), put in [results/GTA5/model](https://github.com/jinyeying/nighttime_dehaze/tree/main/results/GTA5/model).\nSimilarly, for [NHR.pt](https://www.dropbox.com/scl/fi/g6gzmjz6eynjqq02lksk0/NHR.pt?rlkey=61o5mck5zrracxoipbdfmmokx\u0026dl=0), [NHM.pt](https://www.dropbox.com/scl/fi/bncvz68qrhakq0ws2un4w/NHM.pt?rlkey=rowzho61jyn06v2q5gxj8c7jw\u0026dl=0), [NHC.pt](https://www.dropbox.com/scl/fi/899sug9o9cwrjdxx61raa/NHC.pt?rlkey=e7vye94mbgut8oicp1yl3kuva\u0026dl=0),\n3. Run the [Python code](https://github.com/jinyeying/nighttime_dehaze/blob/main/main_test.py),\n```\nCUDA_VISIBLE_DEVICES=1 python main_test.py --dataset NHM --datasetpath /diskc/yeying/night_dehaze/dataset/middlebury/testA/ \nCUDA_VISIBLE_DEVICES=1 python main_test.py --dataset NHC --datasetpath /diskc/yeying/night_dehaze/dataset/Cityscape/testA/ \nCUDA_VISIBLE_DEVICES=1 python main_test.py --dataset NHR --datasetpath /diskc/yeying/night_dehaze/dataset/NHR/testA/ \nCUDA_VISIBLE_DEVICES=1 python main_test.py --dataset GTA5 --datasetpath /diskc/yeying/night_dehaze/GTA5/testA/\n```\n\n* Evaluation: \nSet the dataset_name `GTA5` or `NHR` or `NHM` or `NHC`, and run the [Python code](https://github.com/jinyeying/nighttime_dehaze/blob/main/0_ACMMM23_RESULTS/calculate_psnr_ssim_NH_GTA5.py):\n```\npython calculate_psnr_ssim_NH_GTA5.py\n```\n| Dataset | PSNR | SSIM | \n|--------|------|------ |\n| GTA5| **30.383** |**0.9042**|\n| NHR | **26.56** |**0.89**|\n| NHM | **33.76** |**0.92**|\n| NHC | **38.86** |**0.97**|\n\n## APSF-Guided Nighttime Glow Rendering\nRun the [Matlab code](https://github.com/jinyeying/nighttime_dehaze/blob/main/APSF_GLOW_RENDER_CODE/synthetic_glow_pairs.m) to obtain the clean and glow pairs:\n```\nAPSF_GLOW_RENDER_CODE/synthetic_glow_pairs.m\n````\nChange the datapath `nighttime_dehaze/paired_data/clean_data/`, \u003cbr\u003e\nthe `paired clean and glow results` are saved in [nighttime_dehaze/paired_data/clean/](https://github.com/jinyeying/nighttime_dehaze/tree/main/paired_data/clean) and [nighttime_dehaze/paired_data/glow/](https://github.com/jinyeying/nighttime_dehaze/tree/main/paired_data/glow), \u003cbr\u003e\nthe visualization of `light source maps` are in [nighttime_dehaze/paired_data/glow_render_visual/light_source/](https://github.com/jinyeying/nighttime_dehaze/tree/main/paired_data/glow_render_visual/light_source).\n\n\u003cp align=\"left\"\u003e\n  \u003cimg width=650\" src=\"teaser/APSF1.png\"\u003e\n\u003c/p\u003e\n\u003cp align=\"left\"\u003e\n  \u003cimg width=650\" src=\"teaser/APSF2.png\"\u003e\n\u003c/p\u003e\n\nRun the [Matlab code](https://github.com/jinyeying/nighttime_dehaze/blob/main/APSF_GLOW_RENDER_CODE/synthetic_glow_fig3_visualization.m) to visualize Fig.3 in the main paper:\n```\nAPSF_GLOW_RENDER_CODE/synthetic_glow_fig3_visualization.m\n```\n\u003cp align=\"left\"\u003e\n  \u003cimg width=950\" src=\"teaser/APSF_Fig3.png\"\u003e\n\u003c/p\u003e\n\nAPSF and Alpha Matting are the implementations of the papers:\u003cbr\u003e\n* `CVPR03`\n*Shedding Light on the Weather* [[Paper](https://cave.cs.columbia.edu/old/publications/pdfs/Narasimhan_CVPR03.pdf)]\n* `CVPR06`\n*A Closed-Form Solution to Natural Image Matting* [[Paper](https://people.csail.mit.edu/alevin/papers/Matting-Levin-Lischinski-Weiss-CVPR06.pdf)]\n\n## Edge\nRun the [Python code](https://github.com/jinyeying/nighttime_dehaze/blob/main/EDGE/main.py) to visualize Fig.6, the environment is Pytorch 1.9 with cuda 10.1 and cudnn 7.5, results are in [EDGE/results](https://github.com/jinyeying/nighttime_dehaze/tree/main/EDGE/results).\n```\nconda install pytorch==1.9.0 torchvision==0.10.0 torchaudio==0.9.0 cudatoolkit=10.1 -c pytorch\n```\n```\npython main.py --sa --dil --gpu 1 --datadir ./Input/ --evaluate-converted\n```\n\u003cp align=\"left\"\u003e\n  \u003cimg width=550\" src=\"teaser/edge_Fig6.png\"\u003e\n\u003c/p\u003e\n\n## Enhancement\nRun the [Matlab code](https://github.com/jinyeying/nighttime_dehaze/blob/main/ENHANCEMENT/get_texture_attention.m) to visualize Fig.8, results are in [ENHANCEMENT/attention_map](https://github.com/jinyeying/nighttime_dehaze/tree/main/ENHANCEMENT/attention_map).\n\u003cp align=\"left\"\u003e\n  \u003cimg width=550\" src=\"teaser/attention_Fig8.png\"\u003e\n\u003c/p\u003e\n\nRun the [Matlab code](https://github.com/jinyeying/nighttime_dehaze/blob/main/ENHANCEMENT/get_fig10.m) to visualize Fig.10.\n\u003cp align=\"left\"\u003e\n  \u003cimg width=550\" src=\"teaser/enhance_Fig10.png\"\u003e\n\u003c/p\u003e\n\n\n## License\nThe code and models in this repository are licensed under the MIT License for academic and other non-commercial uses.\u003cbr\u003e\nFor commercial use of the code and models, separate commercial licensing is available. Please contact:\n- Yeying Jin (jinyeying@u.nus.edu)\n- Robby T. Tan (tanrobby@gmail.com)\n- Jonathan Tan (jonathan_tano@nus.edu.sg)\n\n## Citation\nIf this work or the Internet data is useful for your research, please cite our paper. \n```BibTeX\n@inproceedings{jin2023enhancing,\n  title={Enhancing visibility in nighttime haze images using guided apsf and gradient adaptive convolution},\n  author={Jin, Yeying and Lin, Beibei and Yan, Wending and Yuan, Yuan and Ye, Wei and Tan, Robby T},\n  booktitle={Proceedings of the 31st ACM International Conference on Multimedia},\n  pages={2446--2457},\n  year={2023}\n}\n\n@inproceedings{jin2022unsupervised,\n  title={Unsupervised night image enhancement: When layer decomposition meets light-effects suppression},\n  author={Jin, Yeying and Yang, Wenhan and Tan, Robby T},\n  booktitle={European Conference on Computer Vision},\n  pages={404--421},\n  year={2022},\n  organization={Springer}\n}\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjinyeying%2Fnighttime_dehaze","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjinyeying%2Fnighttime_dehaze","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjinyeying%2Fnighttime_dehaze/lists"}