File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
packages/examples/cvat/exchange-oracle/src/handlers Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -1465,6 +1465,10 @@ def _prepare_gt_roi_dataset(self):
14651465 categories = self ._gt_dataset .categories (), media_type = dm .Image
14661466 )
14671467
1468+ roi_info_by_point_id : dict [int , skeletons_from_boxes_task .RoiInfo ] = {
1469+ roi_info .point_id : roi_info for roi_info in self ._rois
1470+ }
1471+
14681472 for sample in self ._gt_dataset :
14691473 for gt_bbox in sample .annotations :
14701474 assert isinstance (gt_bbox , dm .Bbox )
@@ -1474,10 +1478,15 @@ def _prepare_gt_roi_dataset(self):
14741478 self .escrow_address , self .chain_id , self ._roi_filenames [point_id ]
14751479 )
14761480
1481+ # update gt bbox coordinates to match RoI shift
1482+ roi_info = roi_info_by_point_id [point_id ]
1483+ new_x = gt_bbox .points [0 ] - roi_info .roi_x
1484+ new_y = gt_bbox .points [1 ] - roi_info .roi_y
1485+
14771486 self ._gt_roi_dataset .put (
14781487 sample .wrap (
14791488 id = os .path .splitext (gt_roi_filename )[0 ],
1480- annotations = [gt_bbox ],
1489+ annotations = [gt_bbox . wrap ( x = new_x , y = new_y ) ],
14811490 media = dm .Image (path = gt_roi_filename , size = sample .media_as (dm .Image ).size ),
14821491 attributes = filter_dict (sample .attributes , exclude_keys = ["id" ]),
14831492 )
You can’t perform that action at this time.
0 commit comments