Skip to content

Commit

Permalink
Update has_mask method for mmdet models (handle an edge case) (#1066)
Browse files Browse the repository at this point in the history
Co-authored-by: fatih c. akyon <[email protected]>
  • Loading branch information
ccomkhj and fcakyon authored Aug 27, 2024
1 parent 16c45ac commit 19a4334
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sahi/models/mmdet.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 19a4334

Please sign in to comment.