Skip to content

Commit cd680b1

Browse files
Merge pull request #1268 from roboflow/fix/scale-sv-detections-data-polygon
Fix/scale sv detections data polygon
2 parents e679e56 + 47b28af commit cd680b1

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

inference/core/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "0.49.1"
1+
__version__ = "0.49.2"
22

33

44
if __name__ == "__main__":

inference/core/workflows/core_steps/common/utils.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
PARENT_COORDINATES_KEY,
3232
PARENT_DIMENSIONS_KEY,
3333
PARENT_ID_KEY,
34+
POLYGON_KEY_IN_SV_DETECTIONS,
3435
PREDICTION_TYPE_KEY,
3536
ROOT_PARENT_COORDINATES_KEY,
3637
ROOT_PARENT_DIMENSIONS_KEY,
@@ -389,6 +390,12 @@ def scale_sv_detections(
389390
scaled_detection_mask = np.sum(polygon_masks, axis=0) > 0
390391
scaled_masks.append(scaled_detection_mask)
391392
detections_copy.mask = np.array(scaled_masks)
393+
if POLYGON_KEY_IN_SV_DETECTIONS in detections_copy.data:
394+
detections_copy.data[POLYGON_KEY_IN_SV_DETECTIONS] = (
395+
(detections_copy.data[POLYGON_KEY_IN_SV_DETECTIONS] * scale)
396+
.round()
397+
.astype(np.int32)
398+
)
392399
if SCALING_RELATIVE_TO_PARENT_KEY in detections_copy.data:
393400
detections_copy[SCALING_RELATIVE_TO_PARENT_KEY] = (
394401
detections_copy[SCALING_RELATIVE_TO_PARENT_KEY] * scale

requirements/requirements.cli.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
requests>=2.32.0,<3.0.0
22
docker>=7.0.0,<8.0.0
3+
click<8.2.0 # temporary pin until fastapi/typer#1145 is released
34
typer>=0.9.0,<=0.12.5
45
rich>=13.0.0,<13.10.0
56
PyYAML~=6.0.0

0 commit comments

Comments
 (0)