How to run through the defogging algorithm based on AOD-NET
Article directory
Preface`
Source of paper:
If you want to understand the principle of the algorithm, please read this article https://blog.csdn.net/Flag_ing/article/details/108923617
1. Environment configuration
window10 or window11 system
python3.7; pytorch0.4; use Anaconda to manage the programming environment;
python language programming software is pycharm
2. Resources
Paper address: https://arxiv.org/pdf/1707.06543.pdf
Related code: https://github.com/MayankSingal/PyTorch-Image-Dehazing
Data set download: https://sites.google.com/site/boyilics/website-builder/project-pag
————————————————
3. How to use the code
Get this file after downloading the code from github
After unzipping it, the file contains these things
Create a new folder unknown here and name it data
Open data, create new data and images folders, and copy the images of the two data sets training images and original images downloaded from the original author's website into the data and images folders respectively. The original author's data set may need to be downloaded through the wall. If it cannot be downloaded, I can share it in the comment area, plus its code in GitHub.
The two data sets are as follows:
Use pycharm to open the project file
Parts of the code that need to be modified:
1. The code in line 27 of dataloader.py:
image = image.split("/")[-1]
After change:
image = image.split("/")[-1][5:]
2. The code in line 31 of dehaze.py:
torchvision.utils.save_image(torch.cat((data_hazy, clean_image),0), "results/" + image_path.split("/")[-1])
After change:
torchvision.utils.save_image(torch.cat((data_hazy, clean_image), 0), "results/" + image_path.split("/")[-1][5:])
After making the changes, you can run the code, and after about 10 cycles, the network model will be formed.
4. Operation
Run train.py to train the network
Put the hazy image into test_images and run dehaze.py to test the dehazing effect.
The dehazed pictures are placed in the result folder. The dehazed pictures are as follows:
5. Note
When using codes and data sets, the original text, code and data set sources must be stated.