deeplearning
deeplearning copied to clipboard
get_contoured_mask() is missing
Hi,
I noticed an undefined function, "get_contoured_mask" is called in the PART 2 CONTOUR LABELS.ipynb
and Stage 1 train + Stage 1 test .ipynb
notebooks but doesn't appear to exist in the repo
Hi, Thanks for heads up, working on it right now ! Best
In EDA - PART 2 CONTOUR LABELS
notebook you may see the pipeline and functions for contoured mask target creation with visual plots. Hope this helps
It looks like
get_all_contoured_masks
calls another function, get_contoured_mask
, which isn't defined.
def get_contoured_mask2d(mask):
"""For a single mask file get contour"""
gray = cv2.cvtColor(mask, cv2.COLOR_BGR2GRAY)
(t, binary) = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY)
(_, contours, _) = cv2.findContours(binary.astype(np.uint8),
cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE)
contoured_mask = cv2.drawContours(mask, contours, -1, (0, 0, 255), 2)
contoured_mask = get_contoured_mask(mask)
contoured_mask2d = ((contoured_mask[:, :, 0]==1)*1) + ((contoured_mask[:, :, 2]==255)*2)
return contoured_mask2d
I suspect
get_contoured_mask2d(mask):
just needs to be changed to
get_contoured_mask(mask):
...although for me I get a RecursionError: maximum recursion depth exceeded
error when I proceed with that 🙂
Hi Just by commenting that part I was able to get result.
#contoured_mask = get_contoured_mask(mask)
Hope this helps!