https://github.com/rapidai/rapidorientation
文档方向分类
https://github.com/rapidai/rapidorientation
classification ppstructure table-recognition
Last synced: about 1 year ago
JSON representation
文档方向分类
- Host: GitHub
- URL: https://github.com/rapidai/rapidorientation
- Owner: RapidAI
- License: apache-2.0
- Created: 2023-04-19T01:02:41.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-11-20T15:25:26.000Z (over 1 year ago)
- Last Synced: 2025-05-11T16:03:19.462Z (about 1 year ago)
- Topics: classification, ppstructure, table-recognition
- Language: Python
- Homepage:
- Size: 724 KB
- Stars: 218
- Watchers: 7
- Forks: 15
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
> ## 📣 原有RapidStructure仓库已经移到[RapidDoc](https://github.com/RapidAI/RapidDoc)下了,RapidStructure也将以RapidDoc方式重生
### 简介和说明
该部分主要是做含文字图像方向分类模型。模型来源:[PaddleClas 含文字图像方向分类模型](https://github.com/PaddlePaddle/PaddleClas/blob/177e4be74639c0960efeae2c5166d3226c9a02eb/docs/zh_CN/models/PULC/PULC_text_image_orientation.md)
| 模型类型 | 模型名称 | 模型大小 | 支持种类 |
|:---:|:---:|:---:|:---:|
| 四方向分类 | `rapid_orientation.onnx` | 6.5M | `0 90 180 270`|
### 安装
模型手动下载位置:[link](https://github.com/RapidAI/RapidOrientation/releases/tag/v0.0.0)
由于模型较小,已经将分类模型(`rapid_orientation.onnx`)打包进了whl包内:
```bash
pip install rapid-orientation
```
### Python脚本运行
```python
import cv2
from rapid_orientation import RapidOrientation
orientation_engine = RapidOrientation()
img = cv2.imread("tests/test_files/img_rot180_demo.jpg")
cls_result, _ = orientation_engine(img)
print(cls_result)
```
### 终端运行
用法:
```bash
$ rapid_orientation -h
usage: rapid_orientation [-h] -img IMG_PATH [-m MODEL_PATH]
optional arguments:
-h, --help show this help message and exit
-img IMG_PATH, --img_path IMG_PATH
Path to image for layout.
-m MODEL_PATH, --model_path MODEL_PATH
The model path used for inference.
```
示例:
```bash
rapid_orientation -img test_images/layout.png
```
结果
```python
# 返回结果为str类型,有四类:0 | 90 | 180 | 270
```