Skip to content

Commit 2c68cde

Browse files
committed
uint8 fix
1 parent ad9b1eb commit 2c68cde

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

patched_yolo_infer/elements/CropElement.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def calculate_inference(self, model, imgsz=640, conf=0.35, iou=0.7, segment=Fals
5555
self.polygons = [mask.astype(np.uint16) for mask in pred.masks.xy]
5656
else:
5757
# Get the masks
58-
self.detected_masks = pred.masks.data.cpu().numpy()
58+
self.detected_masks = pred.masks.data.cpu().numpy().astype(np.uint8)
5959

6060

6161
def calculate_real_values(self):
@@ -88,7 +88,7 @@ def calculate_real_values(self):
8888
x_start_global:x_start_global+self.crop.shape[1]] = mask_resized
8989

9090
# Append the masked image to the list of detected_masks_real
91-
self.detected_masks_real.append(black_image)
91+
self.detected_masks_real.append(black_image.astype(np.uint8))
9292

9393
if self.polygons is not None:
9494
# Adjust the mask coordinates
@@ -116,7 +116,7 @@ def resize_results(self):
116116
# Resize mask
117117
mask_resized = cv2.resize(mask, (self.source_image.shape[1], self.source_image.shape[0]),
118118
interpolation=cv2.INTER_NEAREST)
119-
resized_masks.append(mask_resized)
119+
resized_masks.append(mask_resized.astype(np.uint8))
120120

121121

122122
for polygon in self.detected_polygons_real:

0 commit comments

Comments
 (0)