talira

Neural grid-based document unwarping

open sourceMITself-hostablefree

UVDoc is a deep learning model that flattens casual photos of bent, curled and wrinkled paper documents. A fully convolutional network predicts the document's 3D grid mesh together with a 2D unwarping grid, and the photo is resampled along that grid to restore a flat page. It comes from a SIGGRAPH Asia 2023 paper by Floor Verhoeven, Tanguy Magne and Olga Sorkine-Hornung at ETH Zurich's Interactive Geometry Lab, which also published the pseudo-photorealistic UVDoc training dataset and a benchmark. The repository has the pretrained model, a demo script that unwarps your own images, and the training and evaluation code; code and weights are MIT-licensed.

Problems it solves

  • flatten a photo of a curled book page so the text lines run straight again
  • my users photograph crumpled receipts and folded letters and I need them to look flat before OCR
  • remove the bend from a phone picture of a page that wasn't lying flat
  • OCR accuracy drops on photos of warped paper and I want to dewarp the page first
  • open source model that corrects page curvature in a single photo without special hardware
  • dewarp document images from a mobile capture app in a Python pipeline
  • train my own document dewarping network on realistic data with 3D shape annotations
  • benchmark document dewarping methods on DocUNet with a pretrained baseline
  • geometric distortion correction for photographed paper forms, with weights I can use commercially

Features

  • pretrained model included in the repository (model/best_model.pkl)
  • demo script that unwarps any image: python demo.py --img-path
  • predicts a 3D grid mesh and a 2D unwarping grid in one network
  • training code for the UVDoc and Doc3D datasets
  • evaluation scripts for the DocUNet and UVDoc benchmarks
  • UVDoc dataset with physically accurate 3D shape and unwarping annotations
  • published unwarped results for both benchmarks

Alternatives

The same job

These do what UVDoc does.

  1. docTR Document Text Recognition: open source OCR powered by PyTorch

Compare UVDoc with the top 3