Skip to content
Snippets Groups Projects
Commit 345843bf authored by Nattapon Jaroenchai's avatar Nattapon Jaroenchai
Browse files

Update inference.py

parent 04420e85
No related branches found
No related tags found
1 merge request!1updated main for release
......@@ -62,7 +62,16 @@ def prediction_mask(prediction_result, map_name):
wid, hight = prediction_result.shape[0], prediction_result.shape[1]
mask = np.zeros([wid, hight])
mask = cv2.fillPoly(mask, pts=[contour], color=(1,1,1)).astype(int)
masked_img = cv2.bitwise_and(prediction_result, mask)
try:
masked_img = cv2.bitwise_and(prediction_result, mask)
except cv2.error as e:
print("Error with cv2.bitwise_and:")
print("prediction_result shape:", prediction_result.shape)
print("mask shape:", mask.shape)
print("prediction_result dtype:", prediction_result.dtype)
print("mask dtype:", mask.dtype)
raise e
return masked_img
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment