From bcf5b9f302c5279db655376297d13c4287791995 Mon Sep 17 00:00:00 2001 From: Danylo Boiko Date: Sun, 10 Mar 2024 23:44:00 +0200 Subject: [PATCH 1/2] Check that the masks are CPU instead of CUDA Signed-off-by: Danylo Boiko --- src/anomalib/data/utils/boxes.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 = [] From f545ca2547bf7de90c5668e23674730e7a76a2a4 Mon Sep 17 00:00:00 2001 From: Danylo Boiko Date: Sun, 10 Mar 2024 23:52:01 +0200 Subject: [PATCH 2/2] Add a log to the changelog Signed-off-by: Danylo Boiko --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) 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