Skip to content

Commit

Permalink
🐞Fix the error if the device in masks_to_boxes is not both CPU and CU…
Browse files Browse the repository at this point in the history
…DA (openvinotoolkit#1839)

* Check that the masks are CPU instead of CUDA

Signed-off-by: Danylo Boiko <danielboyko02@gmail.com>

* Add a log to the changelog

Signed-off-by: Danylo Boiko <danielboyko02@gmail.com>

---------

Signed-off-by: Danylo Boiko <danielboyko02@gmail.com>
  • Loading branch information
danylo-boiko authored Mar 11, 2024
1 parent 34b3a90 commit 07bf60b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- 🐞Fix visualization by @ashwinvaidya17 in https://github.com/openvinotoolkit/anomalib/pull/1766
- 🩹Minor fixes by @ashwinvaidya17 in https://github.com/openvinotoolkit/anomalib/pull/1788
- ⏳ Restore Images by @ashwinvaidya17 in https://github.com/openvinotoolkit/anomalib/pull/1791
- 🐞 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

### New Contributors

Expand Down
6 changes: 3 additions & 3 deletions src/anomalib/data/utils/boxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ def masks_to_boxes(
if anomaly_maps is not None:
anomaly_maps = anomaly_maps.view((-1,) + masks.shape[-2:])

if masks.is_cuda:
batch_comps = connected_components_gpu(masks).squeeze(1)
else:
if masks.is_cpu:
batch_comps = connected_components_cpu(masks).squeeze(1)
else:
batch_comps = connected_components_gpu(masks).squeeze(1)

batch_boxes = []
batch_scores = []
Expand Down

0 comments on commit 07bf60b

Please sign in to comment.