From e0d53b22fb3669a6ef9797da91cb3921c8ea9209 Mon Sep 17 00:00:00 2001 From: Markus Roth Date: Mon, 26 Nov 2012 13:09:02 +0100 Subject: [PATCH] Use intersection/union for overlap computation. This makes sloth consistent with OKAPI and MOT overlap computation. --- sloth/plugins/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sloth/plugins/__init__.py b/sloth/plugins/__init__.py index 07377fd..4625f30 100644 --- a/sloth/plugins/__init__.py +++ b/sloth/plugins/__init__.py @@ -70,7 +70,8 @@ class CopyAnnotationsPlugin(QObject): def overlap(self, r1, r2): ia = float(self.area(self.intersect(r1, r2))) - return min(ia/self.area(r1), ia/self.area(r2)) + union = self.area(r1) + self.area(r2) - ia + return ia / union def intersect(self, r1, r2): x = max(r1[0], r2[0])