diff --git a/CHANGELOG.md b/CHANGELOG.md index 3bd026ca7b..ae3d5d4137 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/anomalib/data/utils/boxes.py b/src/anomalib/data/utils/boxes.py index 8352be20eb..5af6f6470b 100644 --- a/src/anomalib/data/utils/boxes.py +++ b/src/anomalib/data/utils/boxes.py @@ -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 = []