This is an implementation for the paper DE-GAN: A Conditional Generative Adversarial Network for Document Enhancement
DE-GAN is a conditional generative adversarial network designed to enhance the document quality before the recognition process. It could be used for document cleaning, binarization, deblurring and watermark removal. The weights are available to test the enhancement.
This work is only allowed for academic research use. For commercial use, please contact the author.
- Clone this repo:
git clone https://github.com/dali92002/DE-GAN
cd DE-GAN
- Then, download the trained weghts to directly use the model for document enhancement, it is important to save these weights in the subfolder named weights, in the DE-GAN folder. The link to download the weights is : https://drive.google.com/file/d/1J_t-TzR2rxp94SzfPoeuJniSFLfY3HM-/view?usp=sharing
- install the requirements.txt
- To binarize an image use the followng command:
python enhance.py binarize ./image_to_binarize ./directory_to_binarized_image
- To deblur an image use the followng command:
python enhance.py deblur ./image_to_deblur ./directory_to_deblurred_image
blurred image:
enhanced image:
- To remove a watermark from an image use the followng command:
python enhance.py unwatermark ./image_to_unwatermark ./directory_to_unwatermarked_image
watermarked image:
clean image:
- To train with your own data, place your degraded images in the folder "images/A/" and the corresponding ground-truth in the folder "images/B/". It is necessary that each degraded image and its corresponding gt are having the same name (could have different extentions), also, the number images should be the same in both folders.
- Command to train:
python train.py
- Specifying the batch size and the number of epochs could be done inside the code.
- If this work was useful for you, please cite it as:
@ARTICLE{Souibgui2020,
author={Mohamed Ali Souibgui and Yousri Kessentini},
journal={IEEE Transactions on Pattern Analysis and Machine Intelligence},
title={DE-GAN: A Conditional Generative Adversarial Network for Document Enhancement},
year={2020},
doi={10.1109/TPAMI.2020.3022406}}