Closed harshamarupudi56 closed 7 months ago
Alternative versions of functions if you are interested:
def dice_coefficient(im1, im2):
im1 = np.asarray(im1).astype(bool)
im2 = np.asarray(im2).astype(bool)
intersection = np.logical_and(im1, im2)
dice_score = 2. * intersection.sum() / (im1.sum() + im2.sum())
return dice_score
def jaccard_index(img1,img2): img1 = np.asarray(img1).astype(bool) img2 = np.asarray(img2).astype(bool)
intersection = np.logical_and(img1, img2)
union = np.logical_or(img1, img2)
jaccard = intersection.sum() / union.sum()
return jaccard
Hi @harshamarupudi56, thanks for the contribution! This was included in #113 so I'll close this, but thanks for identifying this problem and providing a fix!
Changed numpy.bool to bool to prevent deprecation error.