Skip to content

Commit 740157d

Browse files
maxmnemonicMaksym Lysak
andauthored
feat: Harmonizing pic classes for cvat to docling conversion (#167)
* harmonizing pic classes for cvat to docling conversion Signed-off-by: Maksym Lysak <[email protected]> * pictogram is icon Signed-off-by: Maksym Lysak <[email protected]> --------- Signed-off-by: Maksym Lysak <[email protected]> Co-authored-by: Maksym Lysak <[email protected]>
1 parent cb71009 commit 740157d

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

docling_eval/cvat_tools/cvat_to_docling.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,20 @@ class SemClass(str, Enum):
110110
DEFAULT_CONTAINMENT_THRESH: float = 0.50
111111
DEFAULT_SEM_MATCH_IOU: float = 0.30
112112

113+
pic_classes = {
114+
"BARCODE": "bar_code",
115+
"CHART": "chart",
116+
"DECORATION": "decoration",
117+
"ILLUSTRATION": "illustration",
118+
"INFOGRAPHIC": "infographic",
119+
"LOGO": "logo",
120+
"OTHER": "other",
121+
"PERSON": "person",
122+
"PICTOGRAM": "icon",
123+
"SCREENSHOT": "screenshot",
124+
"UI_ELEMENT": "ui_element",
125+
}
126+
113127

114128
@dataclass(frozen=True)
115129
class Cell:
@@ -1475,12 +1489,14 @@ def _create_item_by_label(
14751489

14761490
if element.type is not None:
14771491
pic_class = element.type
1492+
pic_class_harmonized = pic_classes[pic_class]
1493+
14781494
pic_item.annotations.append(
14791495
PictureClassificationData(
14801496
provenance="human",
14811497
predicted_classes=[
14821498
PictureClassificationClass(
1483-
class_name=pic_class, confidence=1.0
1499+
class_name=pic_class_harmonized, confidence=1.0
14841500
)
14851501
],
14861502
)

0 commit comments

Comments
 (0)