Instructions to use PaddlePaddle/UVDoc_safetensors with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PaddleOCR
How to use PaddlePaddle/UVDoc_safetensors with PaddleOCR:
# 1. See https://www.paddlepaddle.org.cn/en/install to install paddlepaddle # 2. pip install paddleocr from paddleocr import TextImageUnwarping model = TextImageUnwarping(model_name="UVDoc_safetensors") output = model.predict(input="path/to/image.png", batch_size=1) for res in output: res.print() res.save_to_img(save_path="./output/") res.save_to_json(save_path="./output/res.json") - Notebooks
- Google Colab
- Kaggle
UVDoc
Introduction
The main purpose of text image correction is to carry out geometric transformation on the image to correct the document distortion, inclination, perspective deformation and other problems in the image, so that the subsequent text recognition can be more accurate.
| Model | CER |
|---|---|
| UVDoc | 0.179 |
Note: Test data set: docunet benchmark data set.
Model Usage
import requests
from PIL import Image
from transformers import AutoImageProcessor, AutoModel
model_path = "PaddlePaddle/UVDoc_safetensors"
model = AutoModel.from_pretrained(model_path, device_map="auto")
image_processor = AutoImageProcessor.from_pretrained(model_path)
image = Image.open(requests.get("https://paddle-model-ecology.bj.bcebos.com/paddlex/imgs/demo_image/doc_test.jpg", stream=True).raw)
inputs = image_processor(images=image, return_tensors="pt").to(model.device)
outputs = model(**inputs)
result = image_processor.post_process_document_rectification(outputs.last_hidden_state, inputs["original_images"])
print(result)
- Downloads last month
- 744