Home

Awesome

UDoc-GAN

Official PyTorch implementation for ACM MM22 "UDoc-GAN: Unpaired Document Illumination Correction with Background Light Prior"

overall_end

Prerequisites

Datasets

DocProj Datasets

Original DocProj Datasets has either geometric correction or illumination correction. Original DocProj (You do not need to download this dataset.)

For LPNet, it is trained on the DocProj Datasets which has been geometrically corrected and cropped into uniform illumination patches. You can download the datasets directly from Baidu Disk Code: df98 (Note:389_2.png is missing)

For UDoc-GAN, it is trained on the DocProj Datasets which has been geometrically corrected. You can download the datasets directly from Baidu Disk Code: df98

Get Started

Training

For LPNet:

python -m torch.distributed.launch --nproc_per_node=1 --master_port=your_port --data_dir=your_lpnet_data_dir LPNet.py

For UDoc-GAN:

python -m torch.distributed.launch --nproc_per_node=1 --master_port=your_port --data_dir=your_udoc_data_dir UDoc_GAN.py

Testing

You can test one epoch or more epochs by using testone.py or testauto.py

for example, test one epoch:

python testone.py --dataroot=your_data_root

inference

We use window 10 for our inference environments. You also need to install

and then run

python evaluation.py

Pre-Trained Models

The original model is deleted by mistake, we retrain the model and obtain the latest model.

doctr: model results Code: df98

dewarpnet: model results Code: df98

Paper(ED/CER)latest(ED/CER)
DocTr396.17/0.12406.76/0.13
DewarpNet558.61/0.18558.11/0.18

original paper results: doctr, dewarpnet Code: df98

NOTE: In the original DocUNet Benchmark. The '64_1.png' and '64_2.png' distorted images are rotated by 180 degrees. Nearly all previous works ignore this problems and we also don't find this issue. We hope future work can rectify it. For more information, you can refer to DocTr

Citations

@inproceedings{wang2022udoc,
  title={UDoc-GAN: Unpaired Document Illumination Correction with Background Light Prior},
  author={Wang, Yonghui and Zhou, Wengang and Lu, Zhenbo and Li, Houqiang},
  booktitle={Proceedings of the 30th ACM International Conference on Multimedia},
  pages={5074--5082},
  year={2022}
}