Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
SWHL committed Nov 15, 2023
1 parent 35b9d43 commit 7862c4d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 30 deletions.
35 changes: 21 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
## Rapid Structure
<p align="left">
<a href="https://swhl-rapidstructuredemo.hf.space" target="_blank"><img src="https://img.shields.io/badge/%F0%9F%A4%97-Online Demo-blue"></a>
<a href=""><img src="https://img.shields.io/badge/Python->=3.6,<3.12-aff.svg"></a>
<a href=""><img src="https://img.shields.io/badge/OS-Linux%2C%20Win%2C%20Mac-pink.svg"></a>
<a href="https://pepy.tech/project/rapid-layout"><img src="https://static.pepy.tech/personalized-badge/rapid-layout?period=total&units=abbreviation&left_color=grey&right_color=blue&left_text=rapid-layout"></a>
<a href="https://pepy.tech/project/rapid-orientation"><img src="https://static.pepy.tech/personalized-badge/rapid-orientation?period=total&units=abbreviation&left_color=grey&right_color=blue&left_text=rapid-orientation"></a>
<a href="https://pepy.tech/project/rapid-table"><img src="https://static.pepy.tech/personalized-badge/rapid-table?period=total&units=abbreviation&left_color=grey&right_color=blue&left_text=rapid-table"></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>
</p>
<div align="center">
<div align="center">
<h1><b>📃 Rapid Structure</b></h1>
</div>

- 🎉🎉🎉 推出知识星球[RapidAI私享群](https://t.zsxq.com/0duLBZczw),这里的提问会优先得到回答和支持,也会享受到RapidAI组织后续持续优质的服务,欢迎大家的加入。
- 该部分的功能主要针对文档类图像,包括文档图像分类、版面分析和表格识别。
- 可配套使用项目:[RapidOCR](https://github.com/RapidAI/RapidOCR)
<a href="https://swhl-rapidstructuredemo.hf.space" target="_blank"><img src="https://img.shields.io/badge/%F0%9F%A4%97-Online Demo-blue"></a>
<a href=""><img src="https://img.shields.io/badge/Python->=3.6,<3.12-aff.svg"></a>
<a href=""><img src="https://img.shields.io/badge/OS-Linux%2C%20Win%2C%20Mac-pink.svg"></a>
<a href="https://pepy.tech/project/rapid-layout"><img src="https://static.pepy.tech/personalized-badge/rapid-layout?period=total&units=abbreviation&left_color=grey&right_color=blue&left_text=rapid-layout"></a>
<a href="https://pepy.tech/project/rapid-orientation"><img src="https://static.pepy.tech/personalized-badge/rapid-orientation?period=total&units=abbreviation&left_color=grey&right_color=blue&left_text=rapid-orientation"></a>
<a href="https://pepy.tech/project/rapid-table"><img src="https://static.pepy.tech/personalized-badge/rapid-table?period=total&units=abbreviation&left_color=grey&right_color=blue&left_text=rapid-table"></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>

</div>

### 简介
> 🎉 推出知识星球[RapidAI私享群](https://t.zsxq.com/0duLBZczw),这里的提问会优先得到回答和支持,也会享受到RapidAI组织后续持续优质的服务,欢迎大家的加入。
该部分的功能主要针对文档类图像,包括文档图像分类、版面分析和表格识别。

可配套使用项目:[RapidOCR](https://github.com/RapidAI/RapidOCR)

### [文档方向分类](./docs/README_Orientation.md)
### [版面分析](./docs/README_Layout.md)
Expand Down
23 changes: 7 additions & 16 deletions rapid_main.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
# -*- encoding: utf-8 -*-
# @Author: SWHL
# @Contact: [email protected]
import sys
from pathlib import Path
import copy
import pytest

import cv2
import numpy as np

from typing import List, Optional, Tuple, Union

from rapidocr_onnxruntime import RapidOCR
from rapid_table import RapidTable

'''
cur_dir = Path(__file__).resolve().parent
root_dir = cur_dir.parent
sys.path.append(str(root_dir))
'''
from rapid_layout import RapidLayout
from rapid_table import RapidTable


def sorted_boxes(dt_boxes):
num_boxes = dt_boxes.shape[0]
Expand All @@ -30,8 +20,8 @@ def sorted_boxes(dt_boxes):
for i in range(num_boxes - 1):
for j in range(i, -1, -1):
if (
abs(_boxes[j + 1][1] - _boxes[j][1]) < 10
and _boxes[j + 1][0] < _boxes[j][0]
abs(_boxes[j + 1][1] - _boxes[j][1]) < 10
and _boxes[j + 1][0] < _boxes[j][0]
):
tmp = _boxes[j]
_boxes[j] = _boxes[j + 1]
Expand All @@ -53,7 +43,7 @@ def get_boxes(layout_res: list):

# cv2.rectangle(tmp_img, start_point, end_point, (0, 255, 0), 2)
# box = [bbox[0], bbox[1], bbox[2], bbox[3]]
if (label == "table"):
if label == "table":
r_boxes.append(bbox)

# r_boxes = sorted_boxes2(r_boxes)
Expand All @@ -76,6 +66,7 @@ def get_crop_img_list(img, dt_boxes):

return crop_imgs


def test_input():
layout_engine = RapidLayout()

Expand Down

0 comments on commit 7862c4d

Please sign in to comment.