Skip to content

GreatV/DocTrPP

Repository files navigation

DocTrPP: DocTr++ in PaddlePaddle

Introduction

This is a PaddlePaddle implementation of DocTr++. The original paper is DocTr++: Deep Unrestricted Document Image Rectification. The original code is here.

demo

Requirements

You need to install the latest version of PaddlePaddle, which is done through this link.

Training

  1. Data Preparation

To prepare datasets, refer to doc3D.

  1. Training
sh train.sh

or

export OPENCV_IO_ENABLE_OPENEXR=1
export CUDA_VISIBLE_DEVICES=0

python train.py --img-size 288 \
    --name "DocTr++" \
    --batch-size 12 \
    --lr 2.5e-5 \
    --exist-ok \
    --use-vdl
  1. Load Trained Model and Continue Training
export OPENCV_IO_ENABLE_OPENEXR=1
export CUDA_VISIBLE_DEVICES=0

python train.py --img-size 288 \
    --name "DocTr++" \
    --batch-size 12 \
    --lr 2.5e-5 \
    --resume "runs/train/DocTr++/weights/last.ckpt" \
    --exist-ok \
    --use-vdl

Test and Inference

Test the dewarp result on a single image:

python predict.py -i "crop/12_2 copy.png" -m runs/train/DocTr++/weights/best.ckpt -o 12.2.png

document image rectification

Export to onnx

pip install paddle2onnx

python export.py -m ./best.ckpt --format onnx

Model Download

The trained model can be downloaded from here.

About

DocTr++ in PaddlePaddle

Resources

Stars

Watchers

Forks

Packages

No packages published