Skip to content

Commit 3c2751b

Browse files
authored
[CVAT] Updates (#3445)
1 parent e792064 commit 3c2751b

File tree

6 files changed

+49
-3
lines changed

6 files changed

+49
-3
lines changed

packages/examples/cvat/exchange-oracle/src/core/tasks/boxes_from_points.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
from attrs import frozen
99
from datumaro.util import dump_json, parse_json
1010

11+
from src.core.tasks.roi_based import OUTPUT_OBJECT_ID_ATTR
12+
1113
BboxPointMapping = dict[int, int]
1214

1315

@@ -90,3 +92,14 @@ def parse_roi_info(self, rois_info_data: bytes) -> RoiInfos:
9092

9193
def parse_roi_filenames(self, roi_filenames_data: bytes) -> RoiFilenames:
9294
return {int(k): v for k, v in parse_json(roi_filenames_data).items()}
95+
96+
97+
__all__ = [
98+
"OUTPUT_OBJECT_ID_ATTR",
99+
"BboxPointMapping",
100+
"RoiInfo",
101+
"RoiInfos",
102+
"RoiFilenames",
103+
"TaskMetaLayout",
104+
"TaskMetaSerializer",
105+
]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
OUTPUT_OBJECT_ID_ATTR = "object_id"

packages/examples/cvat/exchange-oracle/src/core/tasks/skeletons_from_boxes.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from datumaro.util import dump_json, parse_json
1010

1111
from src.core.config import Config
12+
from src.core.tasks.roi_based import OUTPUT_OBJECT_ID_ATTR
1213

1314
DEFAULT_ASSIGNMENT_SIZE_MULTIPLIER = Config.core_config.skeleton_assignment_size_mult
1415

@@ -133,3 +134,15 @@ def parse_point_labels(self, point_labels_data: bytes) -> PointLabelsMapping:
133134
(v["skeleton_label"], v["point_label"]): v["job_point_label"]
134135
for v in parse_json(point_labels_data)
135136
}
137+
138+
139+
__all__ = [
140+
"OUTPUT_OBJECT_ID_ATTR",
141+
"SkeletonBboxMapping",
142+
"RoiInfo",
143+
"RoiInfos",
144+
"RoiFilenames",
145+
"PointLabelsMapping",
146+
"TaskMetaLayout",
147+
"TaskMetaSerializer",
148+
]

packages/examples/cvat/exchange-oracle/src/handlers/job_export.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,18 @@ def _process_merged_dataset(self, input_dataset: Dataset) -> Dataset:
262262
).elements[0]
263263
old_x, old_y = old_point.points[:2]
264264

265+
roi_anns = [
266+
roi_ann.wrap(
267+
id=roi_info.point_id,
268+
attributes={
269+
**roi_sample.attributes,
270+
boxes_from_points_task.OUTPUT_OBJECT_ID_ATTR: roi_info.point_id,
271+
},
272+
)
273+
for roi_ann in roi_sample.annotations
274+
if isinstance(roi_ann, dm.Bbox)
275+
]
276+
265277
merged_sample.annotations.extend(
266278
annotation_utils.shift_ann(
267279
roi_ann,
@@ -270,8 +282,7 @@ def _process_merged_dataset(self, input_dataset: Dataset) -> Dataset:
270282
img_w=image_w,
271283
img_h=image_h,
272284
)
273-
for roi_ann in roi_sample.annotations
274-
if isinstance(roi_ann, dm.Bbox)
285+
for roi_ann in roi_anns
275286
)
276287

277288
return merged_sample_dataset
@@ -456,6 +467,7 @@ def _process_dataset(self, dataset: Dataset, *, ann_descriptor: FileDescriptor)
456467
],
457468
label=self.bbox_label_to_merged[old_bbox.label],
458469
id=old_bbox.id,
470+
attributes={skeletons_from_boxes_task.OUTPUT_OBJECT_ID_ATTR: old_bbox.id},
459471
)
460472
skeleton_sample.annotations.append(merged_skeleton)
461473

packages/examples/cvat/recording-oracle/src/core/config.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,12 @@ class ValidationConfig:
177177
value small enough for faster convergence rate of the annotation process.
178178
"""
179179

180+
enable_gt_bans = to_bool(getenv("ENABLE_GT_BANS", "1"))
181+
"""
182+
Whether to allow automatic GT bans for bad images or not. By default, bans are allowed.
183+
This can raise escrow annotation chances at the cost of reduced quality threshold.
184+
"""
185+
180186
unverifiable_assignments_threshold = float(getenv("UNVERIFIABLE_ASSIGNMENTS_THRESHOLD", "0.1"))
181187
"""
182188
Deprecated. Not expected to happen in practice, kept only as a safety fallback rule.

packages/examples/cvat/recording-oracle/src/handlers/process_intermediate_results.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,8 @@ def _get_available_gt(self) -> tuple[GtStats, dict[int, set[GtKey]]]:
574574
gt_key
575575
for gt_key, gt_stat in self.gt_stats.items()
576576
if gt_stat.enabled
577-
if gt_stat.rating > 1 - self.manifest.validation.min_quality
577+
if not Config.validation.enable_gt_bans
578+
or (gt_stat.rating > 1 - self.manifest.validation.min_quality)
578579
}, task_id_to_gt_keys
579580

580581
def _check_warmup_annotation_speed(self):

0 commit comments

Comments
 (0)