mirror of
https://github.com/opendatalab/MinerU.git
synced 2026-09-21 12:42:22 +08:00
Merge pull request #1325 from pangguosheng1106/dev
fix: skip the char corresponding to invalid bounding boxes
This commit is contained in:
@@ -108,6 +108,10 @@ def fill_char_in_spans(spans, all_chars):
|
||||
spans = sorted(spans, key=lambda x: x['bbox'][1])
|
||||
|
||||
for char in all_chars:
|
||||
# 跳过非法bbox的char
|
||||
x1, y1, x2, y2 = char['bbox']
|
||||
if abs(x1 - x2) <= 0.01 or abs(y1 - y2) <= 0.01:
|
||||
continue
|
||||
for span in spans:
|
||||
if calculate_char_in_span(char['bbox'], span['bbox'], char['c']):
|
||||
span['chars'].append(char)
|
||||
|
||||
@@ -70,7 +70,7 @@ def _remove_overlap_between_bboxes(arr):
|
||||
res[i] = None
|
||||
else:
|
||||
keeps[idx] = False
|
||||
drop_reasons.append(drop_reasons)
|
||||
drop_reasons.append(drop_reason)
|
||||
if keeps[idx]:
|
||||
res[idx] = v
|
||||
return res, drop_reasons
|
||||
|
||||
Reference in New Issue
Block a user