fix: SegmDetectorCombined, BboxDetectorCombined - return empty mask instead of None
This commit is contained in:
@@ -2,7 +2,7 @@ import configparser
|
||||
import os
|
||||
|
||||
|
||||
version_code = [4, 87, 5]
|
||||
version_code = [4, 87, 6]
|
||||
version = f"V{version_code[0]}.{version_code[1]}" + (f'.{version_code[2]}' if len(version_code) > 2 else '')
|
||||
|
||||
dependency_version = 20
|
||||
|
||||
@@ -151,6 +151,10 @@ class SegmDetectorCombined:
|
||||
|
||||
def doit(self, segm_detector, image, threshold, dilation):
|
||||
mask = segm_detector.detect_combined(image, threshold, dilation)
|
||||
|
||||
if mask is None:
|
||||
mask = torch.zeros((image.shape[2], image.shape[1]), dtype=torch.float32, device="cpu")
|
||||
|
||||
return (mask.unsqueeze(0),)
|
||||
|
||||
|
||||
@@ -167,6 +171,10 @@ class BboxDetectorCombined(SegmDetectorCombined):
|
||||
|
||||
def doit(self, bbox_detector, image, threshold, dilation):
|
||||
mask = bbox_detector.detect_combined(image, threshold, dilation)
|
||||
|
||||
if mask is None:
|
||||
mask = torch.zeros((image.shape[2], image.shape[1]), dtype=torch.float32, device="cpu")
|
||||
|
||||
return (mask.unsqueeze(0),)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user