Skip to content

Commit e528585

Browse files
committed
Fix detection bounding box types
1 parent fb53880 commit e528585

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

model_api/python/model_api/models/detection_model.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,10 @@ def _resize_detections(self, detection_result: DetectionResult, meta: dict):
9494
boxes = detection_result.bboxes
9595
boxes[:, 0::2] = (boxes[:, 0::2] * self.w - pad_left) * inverted_scale_x
9696
boxes[:, 1::2] = (boxes[:, 1::2] * self.h - pad_top) * inverted_scale_y
97+
np.round(boxes, out=boxes)
9798
boxes[:, 0::2] = np.clip(boxes[:, 0::2], 0, input_img_widht)
9899
boxes[:, 1::2] = np.clip(boxes[:, 1::2], 0, input_img_height)
99-
np.round(boxes, out=boxes)
100+
detection_result.bboxes = boxes.astype(np.int32)
100101

101102
def _filter_detections(self, detection_result: DetectionResult, box_area_threshold=0.0):
102103
"""Filters detections by confidence threshold and box size threshold

model_api/python/model_api/tilers/detection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def _merge_results(self, results: list[dict], shape: tuple[int, int, int]) -> De
114114
saliency_map = self._merge_saliency_maps(saliency_maps, shape, tiles_coords) if saliency_maps else np.ndarray(0)
115115

116116
return DetectionResult(
117-
bboxes=detections_array[:, 2:],
117+
bboxes=detections_array[:, 2:].astype(np.int32),
118118
labels=detections_array[:, 0].astype(np.int32),
119119
scores=detections_array[:, 1],
120120
saliency_map=saliency_map,

0 commit comments

Comments
 (0)