cimo001 commited on
Commit
c67e7bf
·
verified ·
1 Parent(s): 3e055a0
Files changed (1) hide show
  1. README.md +74 -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,73 @@ 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 |
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 cropped table, not a full page: use the `table` boxes from PP-DocLayout_plus-L.
135
+ - Input = RGB image with the short side resized to 256, center cropped to 224x224, scaled to 0..1<br>
136
+ then normalized with the ImageNet mean / std, CHW with batch dimension.
137
+ - Feed = `x`, the only input, fixed at 224x224 with a dynamic batch.
138
+ - Output = `[1, 2]` already softmaxed, index 0 = `wired`, index 1 = `wireless`.
139
+ - The label picks the cell detection model: `wired` = RT-DETR-L_wired_table_cell_det,<br>
140
+ `wireless` = RT-DETR-L_wireless_table_cell_det.
141
+
142
+ ## RT-DETR-L_wired_table_cell_det
143
+
144
+ - [RT-DETR-L_wired_table_cell_det/src/example.py](RT-DETR-L_wired_table_cell_det/src/example.py)
145
+
146
+ ```
147
+ python3 RT-DETR-L_wired_table_cell_det/src/example.py Table_1.jpg
148
+ ```
149
+
150
+ ```
151
+ 0.953868 | [467, 189, 1012, 216]
152
+ 0.953357 | [467, 162, 1012, 189]
153
+ 0.953275 | [467, 216, 1012, 243]
154
+ 0.951546 | [467, 243, 1012, 270]
155
+ 0.950149 | [467, 135, 1012, 162]
156
+ ```
157
+
158
+ Note:
159
+ - Input = a single cropped table with the borders drawn: use it when PP-LCNet_x1_0_table_cls<br>
160
+ answers `wired`.
161
+ - Input = RGB image resized to 640x640, float32 0..1, CHW with batch dimension.
162
+ - Feed = `image`, `im_shape` (640, 640), `scale_factor` (640 / height, 640 / width).
163
+ - Output row = `[classId, score, x1, y1, x2, y2]` with coordinates already in the cropped table space,<br>
164
+ the box count is in the second output.
165
+ - 1 label class only, `classId` is always 0 (cell), so the class is not printed.
166
+ - Output = always 300 rows: filter by score (0.3 in the example) and remove the duplicates on your side,<br>
167
+ the example drops a box over 0.5 of intersection over union or over 0.9 of containment.
168
+ - The boxes are the single cells: cluster their edges to rebuild the rows / columns and the spans.
169
+
170
+ ## RT-DETR-L_wireless_table_cell_det
171
+
172
+ - [RT-DETR-L_wireless_table_cell_det/src/example.py](RT-DETR-L_wireless_table_cell_det/src/example.py)
173
+
174
+ ```
175
+ python3 RT-DETR-L_wireless_table_cell_det/src/example.py Table_1.jpg
176
+ ```
177
+
178
+ ```
179
+ 0.951309 | [464, 162, 1009, 189]
180
+ 0.950602 | [464, 189, 1010, 216]
181
+ 0.950491 | [464, 216, 1010, 243]
182
+ 0.950054 | [464, 243, 1010, 270]
183
+ 0.949992 | [464, 297, 1010, 324]
184
+ ```
185
+
186
+ Note:
187
+ - Same input, feed and output of RT-DETR-L_wired_table_cell_det, only the weights change: use it when<br>
188
+ PP-LCNet_x1_0_table_cls answers `wireless`.
189
+ - Input = a single cropped table without the borders drawn, the cells are separated by the spacing only.