Skip to content

Instantly share code, notes, and snippets.

View bowenc0221's full-sized avatar

Bowen Cheng bowenc0221

View GitHub Profile
@bowenc0221
bowenc0221 / boundary_iou_example.py
Created April 5, 2021 05:33
Calculate Boundary IoU of two binary mask
# GitHub repo: https://github.com/bowenc0221/boundary-iou-api
import cv2
import numpy as np
# General util function to get the boundary of a binary mask.
def mask_to_boundary(mask, dilation_ratio=0.02):
"""
Convert binary mask to boundary mask.