mirror of
https://github.com/DS4SD/docling.git
synced 2025-07-27 04:24:45 +00:00
fix: Measure the layout mAP without the orphan clusters.
Signed-off-by: Nikos Livathinos <nli@zurich.ibm.com>
This commit is contained in:
parent
c47ae700ec
commit
e824996406
@ -264,26 +264,29 @@ class LayoutPostprocessor:
|
|||||||
# Remove clusters with no cells
|
# Remove clusters with no cells
|
||||||
clusters = [cluster for cluster in clusters if cluster.cells]
|
clusters = [cluster for cluster in clusters if cluster.cells]
|
||||||
|
|
||||||
# Handle orphaned cells
|
###########################################################################################
|
||||||
unassigned = self._find_unassigned_cells(clusters)
|
# Debug
|
||||||
if unassigned:
|
# # Handle orphaned cells
|
||||||
next_id = max((c.id for c in clusters), default=0) + 1
|
# unassigned = self._find_unassigned_cells(clusters)
|
||||||
orphan_clusters = []
|
# if unassigned:
|
||||||
for i, cell in enumerate(unassigned):
|
# next_id = max((c.id for c in clusters), default=0) + 1
|
||||||
conf = 1.0
|
# orphan_clusters = []
|
||||||
if isinstance(cell, OcrCell):
|
# for i, cell in enumerate(unassigned):
|
||||||
conf = cell.confidence
|
# conf = 1.0
|
||||||
|
# if isinstance(cell, OcrCell):
|
||||||
|
# conf = cell.confidence
|
||||||
|
|
||||||
orphan_clusters.append(
|
# orphan_clusters.append(
|
||||||
Cluster(
|
# Cluster(
|
||||||
id=next_id + i,
|
# id=next_id + i,
|
||||||
label=DocItemLabel.TEXT,
|
# label=DocItemLabel.TEXT,
|
||||||
bbox=cell.bbox,
|
# bbox=cell.bbox,
|
||||||
confidence=conf,
|
# confidence=conf,
|
||||||
cells=[cell],
|
# cells=[cell],
|
||||||
)
|
# )
|
||||||
)
|
# )
|
||||||
clusters.extend(orphan_clusters)
|
# clusters.extend(orphan_clusters)
|
||||||
|
###########################################################################################
|
||||||
|
|
||||||
# Iterative refinement
|
# Iterative refinement
|
||||||
prev_count = len(clusters) + 1
|
prev_count = len(clusters) + 1
|
||||||
|
Loading…
Reference in New Issue
Block a user