Skip to content

Commit 9d31461

Browse files
danylo-boikoBepitic
authored andcommitted
🐞Fix the error if the device in masks_to_boxes is not both CPU and CUDA (open-edge-platform#1839)
* Check that the masks are CPU instead of CUDA Signed-off-by: Danylo Boiko <[email protected]> * Add a log to the changelog Signed-off-by: Danylo Boiko <[email protected]> --------- Signed-off-by: Danylo Boiko <[email protected]> Signed-off-by: Bepitic <[email protected]>
1 parent c962da6 commit 9d31461

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
110110
- 🐞Fix visualization by @ashwinvaidya17 in https://github.com/openvinotoolkit/anomalib/pull/1766
111111
- 🩹Minor fixes by @ashwinvaidya17 in https://github.com/openvinotoolkit/anomalib/pull/1788
112112
- ⏳ Restore Images by @ashwinvaidya17 in https://github.com/openvinotoolkit/anomalib/pull/1791
113+
- 🐞 Fix the error if the device in masks_to_boxes is not both CPU and CUDA by @danylo-boiko https://github.com/openvinotoolkit/anomalib/pull/1839
113114

114115
### New Contributors
115116

src/anomalib/data/utils/boxes.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ def masks_to_boxes(
3131
if anomaly_maps is not None:
3232
anomaly_maps = anomaly_maps.view((-1,) + masks.shape[-2:])
3333

34-
if masks.is_cuda:
35-
batch_comps = connected_components_gpu(masks).squeeze(1)
36-
else:
34+
if masks.is_cpu:
3735
batch_comps = connected_components_cpu(masks).squeeze(1)
36+
else:
37+
batch_comps = connected_components_gpu(masks).squeeze(1)
3838

3939
batch_boxes = []
4040
batch_scores = []

0 commit comments

Comments
 (0)