Created
June 19, 2017 04:02
-
-
Save domluna/e4f2171e47d97bcf4ba3366acd3e7a70 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def iou(img, y, c): | |
intersection = 0. | |
union = 0. | |
img = img.reshape(-1) | |
y = y.reshape(-1) | |
for i in range(len(img)): | |
intersection += img[i] == c and y[i] == c | |
union += img[i] == c or y[i] == c | |
return intersection / union |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment