Giter Site home page Giter Site logo

cv-reimplementation / bedsr-net-reimplementation Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 3.0 4.41 MB

Unofficial implementation of ''BEDSR-Net: A Deep Shadow Removal from a Single Document Image'' with PyTorch

Home Page: https://openaccess.thecvf.com/content_CVPR_2020/html/Lin_BEDSR-Net_A_Deep_Shadow_Removal_Network_From_a_Single_Document_CVPR_2020_paper.html

License: MIT License

Python 100.00%

bedsr-net-reimplementation's Introduction

BEDSR-Net

This repository is unofficial implementation of BEDSR-Net: A Deep Shadow Removal Network From a Single Document Image [Lin+, CVPR 2020] with PyTorch.

A refined version of IsHYuhi's implementation.

Fix several problems

  1. nn.ConvTranspose2d compatible with higher version of Pytorch
  2. gradcam uses too much vram, use pytorch-grad-cam instead
  3. provide default correct training config
  4. provide easy inference code

Dependencies

Pytorch, torchvision, matplotlib, wandb, albumentations, pytorch-grad-cam

Dataset Structure

The dataset should be formatted like below, train.csv and test.csv can be generated using

python make_dataset.py
.
├── csv/
│   └── Jung/
│       ├── train.csv
│       └── test.csv
└── dataset/
    └── Jung/
        ├── train/
        │   ├── input/
        │   │   ├── *.jpg
        │   │   └── ...
        │   └── target/
        │       ├── *.jpg
        │       └── ...
        └── test/
            ├── input/
            │   ├── *.jpg
            │   └── ...
            └── target/
                ├── *.jpg
                └── ...

Training

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.

Infer

mask sure put all your model state_dict into pretrained directory

python infer.py

result images will be produced in results folder

bedsr-net-reimplementation's People

Contributors

xuhangc avatar

Stargazers

renmoqiqi avatar Naoya Muramatsu avatar W.G.Zhang avatar Jingzhe Zhang avatar Meow avatar Xelawk avatar

Watchers

Kostas Georgiou avatar

bedsr-net-reimplementation's Issues

在训练benet时loss不会下降

我用IsHYuhi's implementation代码训练benet,如果learning_rate设置为0.003,网络预测的background color会变成tensor([[1., 1., 1.]])。但是改成0.0003,loss就能正常下降。
我看到你公开的default correct training config里的learning_rate: 0.003,请问你有做其他的更改让benet可以正常训练吗

Something wrong when run infer.py

python infer.py
Traceback (most recent call last):
...
...
load_state_dict
    raise RuntimeError('Error(s) in loading state_dict for {}:\n\t{}'.format(
RuntimeError: Error(s) in loading state_dict for Generator:
        Unexpected key(s) in state_dict: "CvT6.conv.bias", "CvT7.conv.bias", "CvT8.conv.bias", "CvT9.conv.bias", "CvT10.conv.bias", "CvT11.conv.bias".

pretrained models were download by this link

Pretrained model pth

Hello, do you have a pretrained model trained on RDD dataset?
Thank you for your code

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.