Skip to content

Commit 4657396

Browse files
Fix post-processing for instance-segmentation in inference-exp
1 parent fe76cc1 commit 4657396

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

inference_experimental/inference_exp/models/common/roboflow/post_processing.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,13 @@ def align_instance_segmentation_results(
275275
original_size: ImageDimensions,
276276
inference_size: ImageDimensions,
277277
) -> Tuple[torch.Tensor, torch.Tensor]:
278+
if image_bboxes.shape[0] == 0:
279+
empty_masks = torch.empty(
280+
size=(0, original_size.height, original_size.width),
281+
dtype=torch.bool,
282+
device=image_bboxes.device,
283+
)
284+
return image_bboxes, empty_masks
278285
pad_left, pad_top, pad_right, pad_bottom = padding
279286
offsets = torch.tensor(
280287
[pad_left, pad_top, pad_left, pad_top],
@@ -303,5 +310,5 @@ def align_instance_segmentation_results(
303310
masks,
304311
[original_size.height, original_size.width],
305312
interpolation=functional.InterpolationMode.BILINEAR,
306-
).gt_(0.0)
313+
).gt_(0.0).to(dtype=torch.bool)
307314
return image_bboxes, masks

inference_experimental/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "inference-exp"
3-
version = "0.12.0"
3+
version = "0.13.0"
44
description = "Experimental vresion of inference package which is supposed to evolve into inference 1.0"
55
readme = "README.md"
66
requires-python = ">=3.10,<3.13"

0 commit comments

Comments
 (0)