deeplearning icon indicating copy to clipboard operation
deeplearning copied to clipboard

get_contoured_mask() is missing

Open mattobrien415 opened this issue 6 years ago • 4 comments

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

mattobrien415 avatar Apr 24 '18 23:04 mattobrien415

Hi, Thanks for heads up, working on it right now ! Best

KeremTurgutlu avatar Apr 25 '18 00:04 KeremTurgutlu

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

KeremTurgutlu avatar Apr 25 '18 00:04 KeremTurgutlu

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

screen shot 2018-04-24 at 5 36 03 pm

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 🙂

mattobrien415 avatar Apr 25 '18 00:04 mattobrien415

Hi Just by commenting that part I was able to get result.

#contoured_mask = get_contoured_mask(mask)

Hope this helps!

saurabh502 avatar Aug 21 '18 03:08 saurabh502