Skip to content

Commit a927dbd

Browse files
committed
feat: init
1 parent 6078a24 commit a927dbd

31 files changed

+760
-105775
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
name: 🐞 Bug
3+
about: Bug
4+
title: 'Bug'
5+
labels: 'Bug'
6+
assignees: ''
7+
8+
---
9+
10+
请提供下述完整信息以便快速定位问题
11+
(Please provide the following information to quickly locate the problem)
12+
- **系统环境/System Environment**:
13+
- **使用的是哪门语言的程序/Which programing language**:
14+
- **使用当前库的版本/Use version**:
15+
- **可复现问题的demo和文件/Demo of reproducible problems**:
16+
- **完整报错/Complete Error Message**:
17+
- **可能的解决方案/Possible solutions**:

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: ❓ Questions
4+
url: https://github.com/RapidAI/TableStructureRec/discussions/categories/q-a
5+
about: Please use the community forum for help and questions regarding ProcessLaTeXFormulaTools Docs
6+
- name: 💡 Feature requests and ideas
7+
url: https://github.com/RapidAI/TableStructureRec/discussions/new?category=feature-requests
8+
about: Please vote for and post new feature ideas in the community forum
9+
- name: 📖 Documentation
10+
url: https://rapidai.github.io/TableStructureRec/docs/
11+
about: A great place to find instructions and answers about RapidOCR.

.github/workflows/rapid_unwrap.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Push rapid_unwrap to pypi
2+
3+
on:
4+
push:
5+
tags:
6+
- rapid_unwrap_v*
7+
8+
jobs:
9+
UnitTesting:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Pull latest code
13+
uses: actions/checkout@v3
14+
15+
- name: Set up Python 3.10
16+
uses: actions/setup-python@v4
17+
with:
18+
python-version: '3.10'
19+
architecture: 'x64'
20+
21+
- name: Display Python version
22+
run: python -c "import sys; print(sys.version)"
23+
24+
- name: Unit testings
25+
run: |
26+
pip install -r requirements.txt
27+
pip install pytest
28+
pytest tests/test_uvdoc.py
29+
30+
GenerateWHL_PushPyPi:
31+
needs: UnitTesting
32+
runs-on: ubuntu-latest
33+
34+
steps:
35+
- uses: actions/checkout@v3
36+
37+
- name: Set up Python 3.10
38+
uses: actions/setup-python@v4
39+
with:
40+
python-version: '3.10'
41+
architecture: 'x64'
42+
43+
- name: Run setup.py
44+
run: |
45+
pip install -r requirements.txt
46+
python -m pip install --upgrade pip
47+
pip install wheel get_pypi_latest_version
48+
python setup_uvdoc.py bdist_wheel "${{ github.ref_name }}"
49+
50+
- name: Publish distribution 📦 to PyPI
51+
uses: pypa/[email protected]
52+
with:
53+
password: ${{ secrets.PYPI_API_TOKEN }}
54+
packages_dir: dist/

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/output/
2+
/rapid_unwrap/models/*.onnx

.pre-commit-config.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
repos:
2+
- repo: https://gitee.com/SWHL/autoflake
3+
rev: v2.1.1
4+
hooks:
5+
- id: autoflake
6+
args:
7+
[
8+
"--recursive",
9+
"--in-place",
10+
"--remove-all-unused-imports",
11+
"--remove-unused-variable",
12+
"--ignore-init-module-imports",
13+
]
14+
files: \.py$
15+
- repo: https://gitee.com/SWHL/black
16+
rev: 23.1.0
17+
hooks:
18+
- id: black
19+
files: \.py$

LICENSE

Lines changed: 0 additions & 201 deletions
This file was deleted.

README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<div align="center">
2+
<div align="center">
3+
<h1><b>📊RapidUnWrap</b></h1>
4+
</div>
5+
<a href=""><img src="https://img.shields.io/badge/Python->=3.8,<3.13-aff.svg"></a>
6+
<a href=""><img src="https://img.shields.io/badge/OS-Linux%2C%20Mac%2C%20Win-pink.svg"></a>
7+
<a href="https://semver.org/"><img alt="SemVer2.0" src="https://img.shields.io/badge/SemVer-2.0-brightgreen"></a>
8+
<a href="https://github.com/psf/black"><img src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
9+
<a href="https://github.com/RapidAI/TableStructureRec/blob/c41bbd23898cb27a957ed962b0ffee3c74dfeff1/LICENSE"><img alt="GitHub" src="https://img.shields.io/badge/license-Apache 2.0-blue"></a>
10+
</div>
11+
12+
### 最近更新
13+
14+
- **2024.11.15**
15+
- 完成初版代码,转换 [UVDoc](https://github.com/tanguymagne/UVDoc) 模型为onnx,完善前后处理
16+
17+
18+
### 简介
19+
20+
本仓库用于进行文档扭曲的修正,同时能一定程度缓解透视和旋转问题
21+
22+
23+
### 在线体验
24+
[modelscope](https://www.modelscope.cn/studios/jockerK/DocUnwrap)
25+
### 效果展示
26+
![res_show.jpg](preview.jpg)
27+
28+
### 安装
29+
``` python {linenos=table}
30+
# 建议使用清华源安装 https://pypi.tuna.tsinghua.edu.cn/simple
31+
pip install rapid-unwrap
32+
```
33+
34+
### 快速使用
35+
36+
``` python {linenos=table}
37+
import cv2
38+
39+
from inference import DocUnwrapper
40+
img_path = "img/demo4.jpg"
41+
doc_unwrapper = DocUnwrapper(img_path)
42+
unwrapped_img, elapse = doc_unwrapper(img_path)
43+
print(f"doc unwrap elapse:{elapse}")
44+
cv2.imwrite("unwarped.png", unwrapped_img)
45+
46+
```
47+
48+
49+
### 致谢
50+
51+
[UVDoc](https://github.com/tanguymagne/UVDoc)
52+
53+
54+
### 贡献指南
55+
56+
欢迎提交请求。对于重大更改,请先打开issue讨论您想要改变的内容。
57+
58+
有其他的好建议和集成场景,作者也会积极响应支持
59+
60+
### 开源许可证
61+
62+
该项目采用[Apache 2.0](https://github.com/RapidAI/TableStructureRec/blob/c41bbd23898cb27a957ed962b0ffee3c74dfeff1/LICENSE)
63+
开源许可证。
64+

bad.png

-3.54 MB
Binary file not shown.

demo.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
import cv2
22

3-
from uvdocpredictor import UVDocPredictor
4-
if __name__ == '__main__':
5-
6-
img_path = "img/demo1.png"
7-
model_path = "model/uvdoc.onnx"
8-
predictor = UVDocPredictor(model_path)
9-
unwrapped_img = predictor(img_path)
10-
unwrapped_img = cv2.cvtColor(unwrapped_img, cv2.COLOR_RGB2BGR)
11-
cv2.imwrite("output/unwarped.png", unwrapped_img)
3+
from rapid_unwrap.inference import DocUnwrapper
4+
img_path = "img/demo.jpg"
5+
doc_unwrapper = DocUnwrapper(img_path)
6+
unwrapped_img, elapse = doc_unwrapper(img_path)
7+
print(f"doc unwrap elapse:{elapse}")
8+
cv2.imwrite("unwarped.png", unwrapped_img)

img/demo.jpg

61.7 KB
Loading

0 commit comments

Comments
 (0)