Skip to content

Instantly share code, notes, and snippets.

@domluna
Created June 19, 2017 04:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save domluna/e4f2171e47d97bcf4ba3366acd3e7a70 to your computer and use it in GitHub Desktop.
Save domluna/e4f2171e47d97bcf4ba3366acd3e7a70 to your computer and use it in GitHub Desktop.
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