From 19a4334c68d6e0c240ae34318bc218443c4fe3f4 Mon Sep 17 00:00:00 2001 From: Huijo Date: Tue, 27 Aug 2024 12:44:25 +0200 Subject: [PATCH] Update has_mask method for mmdet models (handle an edge case) (#1066) Co-authored-by: fatih c. akyon <34196005+fcakyon@users.noreply.github.com> --- sahi/models/mmdet.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sahi/models/mmdet.py b/sahi/models/mmdet.py index b4b363d3c..5bae88b6b 100644 --- a/sahi/models/mmdet.py +++ b/sahi/models/mmdet.py @@ -192,7 +192,10 @@ def has_mask(self): """ # has_mask = self.model.model.with_mask train_pipeline = self.model.cfg["train_dataloader"]["dataset"]["pipeline"] - has_mask = any(isinstance(item, dict) and any("mask" in key for key in item.keys()) for item in train_pipeline) + has_mask = any( + isinstance(item, dict) and any("mask" in key and value is True for key, value in item.items()) + for item in train_pipeline + ) return has_mask @property