"...git@developer.sourcefind.cn:chenpangpang/open-webui.git" did not exist on "3f53abb2335170614858c7540c51c0e620b666e0"
Unverified Commit bad353ce authored by Alara Dirik's avatar Alara Dirik Committed by GitHub
Browse files

Fix DETR segmentation postprocessing output (#19363)

Ensures post_process_instance_segmentation and post_process_panoptic_segmentation methods return a tensor of shape (target_height, target_width) filled with -1 values if no segment with score > threshold is found.
parent 45e14038
......@@ -1261,8 +1261,9 @@ class DetrFeatureExtractor(FeatureExtractionMixin, ImageFeatureExtractionMixin):
# No mask found
if mask_probs_item.shape[0] <= 0:
segmentation = None
segments: List[Dict] = []
height, width = target_sizes[i] if target_sizes is not None else mask_probs_item.shape[1:]
segmentation = torch.zeros((height, width)) - 1
results.append({"segmentation": segmentation, "segments_info": []})
continue
# Get segmentation map and segment information of batch item
......@@ -1347,8 +1348,9 @@ class DetrFeatureExtractor(FeatureExtractionMixin, ImageFeatureExtractionMixin):
# No mask found
if mask_probs_item.shape[0] <= 0:
segmentation = None
segments: List[Dict] = []
height, width = target_sizes[i] if target_sizes is not None else mask_probs_item.shape[1:]
segmentation = torch.zeros((height, width)) - 1
results.append({"segmentation": segmentation, "segments_info": []})
continue
# Get segmentation map and segment information of batch item
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment