Home

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 imageNon-shadow imageAttention MapBackground 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

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

TODO