cimo001 commited on
Commit
e91b891
·
verified ·
1 Parent(s): a20fc5e
Files changed (1) hide show
  1. README.md +71 -0
README.md CHANGED
@@ -18,6 +18,9 @@ tags:
18
  | PP-DocLayout_plus-L | pp-docLayout_plus-l.onnx | layout detection |
19
  | PP-OCRv6_medium_det | pp-ocrV6_medium_det.onnx | text line detection |
20
  | PP-OCRv6_medium_rec | pp-ocrV6_medium_rec.onnx | text recognition |
 
 
 
21
 
22
  ## Usage
23
 
@@ -38,6 +41,7 @@ Test images used by the examples:
38
 
39
  - [jp_1.jpg](https://github.com/cimo/One_workspace/blob/main/file/test/jp_1.jpg) = full page
40
  - [det_box_0294.jpg](https://github.com/cimo/One_workspace/blob/main/file/test/det_box_0294.jpg) = single text line
 
41
 
42
  ## PP-DocLayout_plus-L
43
 
@@ -113,3 +117,70 @@ then the blank at index 0.
113
  - Character map = index 0 is the blank, 1..18708 are the lines of<br>
114
  [PP-OCRv6_medium_rec/onnx/dictionary.txt](PP-OCRv6_medium_rec/onnx/dictionary.txt), 18709 is the space.
115
  - Score = mean probability of the kept time steps.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  | PP-DocLayout_plus-L | pp-docLayout_plus-l.onnx | layout detection |
19
  | PP-OCRv6_medium_det | pp-ocrV6_medium_det.onnx | text line detection |
20
  | PP-OCRv6_medium_rec | pp-ocrV6_medium_rec.onnx | text recognition |
21
+ | PP-LCNet_x1_0_table_cls | pp-lcNet_x1_0_table_cls.onnx | table classification (wired / wireless) |
22
+ | RT-DETR-L_wired_table_cell_det | rt-detr-l_wired_table_cell_det.onnx | table cell detection (wired) |
23
+ | RT-DETR-L_wireless_table_cell_det | rt-detr-l_wireless_table_cell_det.onnx | table cell detection (wireless) |
24
 
25
  ## Usage
26
 
 
41
 
42
  - [jp_1.jpg](https://github.com/cimo/One_workspace/blob/main/file/test/jp_1.jpg) = full page
43
  - [det_box_0294.jpg](https://github.com/cimo/One_workspace/blob/main/file/test/det_box_0294.jpg) = single text line
44
+ - [Table_1.jpg](https://github.com/cimo/One_workspace/blob/main/file/test/Table_1.jpg) = single table
45
 
46
  ## PP-DocLayout_plus-L
47
 
 
117
  - Character map = index 0 is the blank, 1..18708 are the lines of<br>
118
  [PP-OCRv6_medium_rec/onnx/dictionary.txt](PP-OCRv6_medium_rec/onnx/dictionary.txt), 18709 is the space.
119
  - Score = mean probability of the kept time steps.
120
+
121
+ ## PP-LCNet_x1_0_table_cls
122
+
123
+ - [PP-LCNet_x1_0_table_cls/src/example.py](PP-LCNet_x1_0_table_cls/src/example.py)
124
+
125
+ ```
126
+ python3 PP-LCNet_x1_0_table_cls/src/example.py Table_1.jpg
127
+ ```
128
+
129
+ ```
130
+ 0.843585 | wired
131
+ ```
132
+
133
+ Note:
134
+ - Input = a single table crop, not a full page: use the `table` boxes from PP-DocLayout_plus-L.
135
+ - Input = RGB image resized so the short side is 256, center cropped to 224x224, scaled to 0..1 then<br>
136
+ normalized with the ImageNet mean / std, CHW with batch dimension.
137
+ - Feed = `x`, the only input, fixed shape `[1, 3, 224, 224]`.
138
+ - Output = `[1, 2]` already softmaxed, index 0 is `wired` (ruled table), index 1 is `wireless` (no ruling lines).
139
+ - Use the label to pick the cell detection model below.
140
+
141
+ ## RT-DETR-L_wired_table_cell_det
142
+
143
+ - [RT-DETR-L_wired_table_cell_det/src/example.py](RT-DETR-L_wired_table_cell_det/src/example.py)
144
+
145
+ ```
146
+ python3 RT-DETR-L_wired_table_cell_det/src/example.py Table_1.jpg
147
+ ```
148
+
149
+ ```
150
+ 0.953868 | [467, 189, 1012, 216]
151
+ 0.953357 | [467, 162, 1012, 189]
152
+ 0.953275 | [467, 216, 1012, 243]
153
+ 0.951546 | [467, 243, 1012, 270]
154
+ 0.950149 | [467, 135, 1012, 162]
155
+ ```
156
+
157
+ Note:
158
+ - Input = a single table crop classified as `wired` by PP-LCNet_x1_0_table_cls.
159
+ - Input = RGB image resized to 640x640, float32 0..1, CHW with batch dimension.
160
+ - Feed = `image`, `im_shape` (640, 640), `scale_factor` (640 / height, 640 / width).
161
+ - Output row = `[classId, score, x1, y1, x2, y2]` with coordinates already in the original image space,<br>
162
+ the box count is in the second output. There is a single class (`cell`).
163
+ - Output = 300 queries per image, no NMS in the model: filter by score (0.3 in the example), then the example<br>
164
+ applies a NMS (IoU 0.5) and drops any box that contains 2 or more smaller boxes (containment 0.9).
165
+ - Cells are returned as axis aligned boxes, merged cells come out as a single wider / taller box:<br>
166
+ snap the edges to a grid on your side to get row / column index and span.
167
+
168
+ ## RT-DETR-L_wireless_table_cell_det
169
+
170
+ - [RT-DETR-L_wireless_table_cell_det/src/example.py](RT-DETR-L_wireless_table_cell_det/src/example.py)
171
+
172
+ ```
173
+ python3 RT-DETR-L_wireless_table_cell_det/src/example.py Table_1.jpg
174
+ ```
175
+
176
+ ```
177
+ 0.951309 | [464, 162, 1009, 189]
178
+ 0.950602 | [464, 189, 1010, 216]
179
+ 0.950491 | [464, 216, 1010, 243]
180
+ 0.950054 | [464, 243, 1010, 270]
181
+ 0.949992 | [464, 297, 1010, 324]
182
+ ```
183
+
184
+ Note:
185
+ - Same input, feed, output and postprocess as RT-DETR-L_wired_table_cell_det.
186
+ - Use it on a table crop classified as `wireless` by PP-LCNet_x1_0_table_cls.