Awesome
BEDSR-Net A Deep Shadow Removal Network from a Single Document Image
This repository is unofficial implementation of BEDSR-Net: A Deep Shadow Removal Network From a Single Document Image [Lin+, CVPR 2020] with PyTorch.
| 🔥Online Demo!(Google CoLab) |
<img width="952" alt="architecture" src="https://user-images.githubusercontent.com/38097069/122442995-1a89f100-cfda-11eb-92ae-160124b5f91d.png">Results
Results from BEDSR-Net pretrained on Jung dataset
Shadow image | Non-shadow image | Attention Map | Background color |
---|---|---|---|
<img src="result/shadow_image.jpg" width="1536"> | <img src="result/non-shadow_image.jpg" width="1536"> | <img src="result/attention_map.jpg" width="1436"> | <img src="result/background_color.jpg" width="1236"> |
Requirements
- Python3.x
- PyTorch 1.8.0
- matplotlib==3.4.2
- albumentations==0.4.6
Training
You can download the Jung dataset: csv/images.
The data folders should be:
./csv
- /Jung
- /train.csv
- /val.csv
- /test.csv
./dataset
- /Jung
- /train
- /img
- /gt
...
- /val
- /img
- /gt
...
- /test
- /img
- /gt
...
Making configs
python3 utils/make_configs.py --model benet bedsrnet
Training BE-Net
python3 train_benet.py ./configs/model\=benet/config.yaml
Training BEDSR-Net
python3 train_bedsrnet.py ./configs/model\=bedsrnet/config.yaml
You can use W&B by --use_wandb
.
Testing
Please check demo.ipynb
.
Trained model
You can download pretrained models trained on Jung dataset.
When you would like to test your own image, you can use demo.ipynb .
References
- BEDSR-Net_A_Deep_Shadow_Removal_Network_from_a_Single_Document_Image, Yun-Hsuan Lin, Wen-Chin Chen, Yung-Yu Chuang, National Taiwan University, [paper]
TODO
- implementation of BE-Net
- training code for BE-Net
- implementation of SR-Net
- training code for BEDSR-Net
- implementation of ST-CGAN-BE
- calculating code (PSNR/SSIM)
- inference code
- Democode in Colab.
- cleaning up / formatting
- Writing README
- providing pretrained model
- providing synthesized data