Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question in pixel_link.py about the function 'cal_gt_for_single_image()' #155

Open
bjxia1 opened this issue Nov 14, 2019 · 0 comments
Open

Comments

@bjxia1
Copy link

bjxia1 commented Nov 14, 2019

bbox_masks = []
    pos_mask = mask.copy()
    for bbox_idx, (bbox_xs, bbox_ys) in enumerate(zip(xs, ys)):
        if labels[bbox_idx] == background_label:
            continue
        
        bbox_mask = mask.copy()
        
        bbox_points = zip(bbox_xs, bbox_ys)
        bbox_contours = util.img.points_to_contours(bbox_points)
        util.img.draw_contours(bbox_mask, bbox_contours, idx = -1, 
                               color = 1, border_width = -1)
        
        bbox_masks.append(bbox_mask)
        
        if labels[bbox_idx] == text_label:
            pos_mask += bbox_mask
        
    # treat overlapped in-bbox pixels as negative, 
    # and non-overlapped  ones as positive
    pos_mask = np.asarray(pos_mask == 1, dtype = np.int32)
    num_positive_pixels = np.sum(pos_mask)

Here just draw contours and set contours to 1, but not set inside the contours to 1.
I think here also need use cv2.fillPoly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant