Skip to content

Commit

Permalink
feat: init
Browse files Browse the repository at this point in the history
  • Loading branch information
Joker1212 committed Nov 15, 2024
1 parent 6078a24 commit a927dbd
Show file tree
Hide file tree
Showing 31 changed files with 760 additions and 105,775 deletions.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: 🐞 Bug
about: Bug
title: 'Bug'
labels: 'Bug'
assignees: ''

---

请提供下述完整信息以便快速定位问题
(Please provide the following information to quickly locate the problem)
- **系统环境/System Environment**:
- **使用的是哪门语言的程序/Which programing language**:
- **使用当前库的版本/Use version**:
- **可复现问题的demo和文件/Demo of reproducible problems**:
- **完整报错/Complete Error Message**:
- **可能的解决方案/Possible solutions**:
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
blank_issues_enabled: false
contact_links:
- name: ❓ Questions
url: https://github.com/RapidAI/TableStructureRec/discussions/categories/q-a
about: Please use the community forum for help and questions regarding ProcessLaTeXFormulaTools Docs
- name: 💡 Feature requests and ideas
url: https://github.com/RapidAI/TableStructureRec/discussions/new?category=feature-requests
about: Please vote for and post new feature ideas in the community forum
- name: 📖 Documentation
url: https://rapidai.github.io/TableStructureRec/docs/
about: A great place to find instructions and answers about RapidOCR.
54 changes: 54 additions & 0 deletions .github/workflows/rapid_unwrap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Push rapid_unwrap to pypi

on:
push:
tags:
- rapid_unwrap_v*

jobs:
UnitTesting:
runs-on: ubuntu-latest
steps:
- name: Pull latest code
uses: actions/checkout@v3

- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
architecture: 'x64'

- name: Display Python version
run: python -c "import sys; print(sys.version)"

- name: Unit testings
run: |
pip install -r requirements.txt
pip install pytest
pytest tests/test_uvdoc.py
GenerateWHL_PushPyPi:
needs: UnitTesting
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
architecture: 'x64'

- name: Run setup.py
run: |
pip install -r requirements.txt
python -m pip install --upgrade pip
pip install wheel get_pypi_latest_version
python setup_uvdoc.py bdist_wheel "${{ github.ref_name }}"
- name: Publish distribution 📦 to PyPI
uses: pypa/[email protected]
with:
password: ${{ secrets.PYPI_API_TOKEN }}
packages_dir: dist/
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/output/
/rapid_unwrap/models/*.onnx
19 changes: 19 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
repos:
- repo: https://gitee.com/SWHL/autoflake
rev: v2.1.1
hooks:
- id: autoflake
args:
[
"--recursive",
"--in-place",
"--remove-all-unused-imports",
"--remove-unused-variable",
"--ignore-init-module-imports",
]
files: \.py$
- repo: https://gitee.com/SWHL/black
rev: 23.1.0
hooks:
- id: black
files: \.py$
201 changes: 0 additions & 201 deletions LICENSE

This file was deleted.

64 changes: 64 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<div align="center">
<div align="center">
<h1><b>📊RapidUnWrap</b></h1>
</div>
<a href=""><img src="https://img.shields.io/badge/Python->=3.8,<3.13-aff.svg"></a>
<a href=""><img src="https://img.shields.io/badge/OS-Linux%2C%20Mac%2C%20Win-pink.svg"></a>
<a href="https://semver.org/"><img alt="SemVer2.0" src="https://img.shields.io/badge/SemVer-2.0-brightgreen"></a>
<a href="https://github.com/psf/black"><img src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
<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>
</div>

### 最近更新

- **2024.11.15**
- 完成初版代码,转换 [UVDoc](https://github.com/tanguymagne/UVDoc) 模型为onnx,完善前后处理


### 简介

本仓库用于进行文档扭曲的修正,同时能一定程度缓解透视和旋转问题


### 在线体验
[modelscope](https://www.modelscope.cn/studios/jockerK/DocUnwrap)
### 效果展示
![res_show.jpg](preview.jpg)

### 安装
``` python {linenos=table}
# 建议使用清华源安装 https://pypi.tuna.tsinghua.edu.cn/simple
pip install rapid-unwrap
```

### 快速使用

``` python {linenos=table}
import cv2

from inference import DocUnwrapper
img_path = "img/demo4.jpg"
doc_unwrapper = DocUnwrapper(img_path)
unwrapped_img, elapse = doc_unwrapper(img_path)
print(f"doc unwrap elapse:{elapse}")
cv2.imwrite("unwarped.png", unwrapped_img)

```


### 致谢

[UVDoc](https://github.com/tanguymagne/UVDoc)


### 贡献指南

欢迎提交请求。对于重大更改,请先打开issue讨论您想要改变的内容。

有其他的好建议和集成场景,作者也会积极响应支持

### 开源许可证

该项目采用[Apache 2.0](https://github.com/RapidAI/TableStructureRec/blob/c41bbd23898cb27a957ed962b0ffee3c74dfeff1/LICENSE)
开源许可证。

Binary file removed bad.png
Binary file not shown.
15 changes: 6 additions & 9 deletions demo.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import cv2

from uvdocpredictor import UVDocPredictor
if __name__ == '__main__':

img_path = "img/demo1.png"
model_path = "model/uvdoc.onnx"
predictor = UVDocPredictor(model_path)
unwrapped_img = predictor(img_path)
unwrapped_img = cv2.cvtColor(unwrapped_img, cv2.COLOR_RGB2BGR)
cv2.imwrite("output/unwarped.png", unwrapped_img)
from rapid_unwrap.inference import DocUnwrapper
img_path = "img/demo.jpg"
doc_unwrapper = DocUnwrapper(img_path)
unwrapped_img, elapse = doc_unwrapper(img_path)
print(f"doc unwrap elapse:{elapse}")
cv2.imwrite("unwarped.png", unwrapped_img)
Binary file added img/demo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a927dbd

Please sign in to comment.