From 7a62d34c1ecbf88b45e114b8df1134609c35720c Mon Sep 17 00:00:00 2001
From: Anton Kullberg <anton.kullberg@liu.se>
Date: Fri, 12 Nov 2021 12:04:33 +0100
Subject: [PATCH] py: avoid matching trajectories with too high rmse

---
 src/utility.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/utility.py b/src/utility.py
index 1d969c0..bdc9b9b 100644
--- a/src/utility.py
+++ b/src/utility.py
@@ -38,9 +38,10 @@ def match_tracks_to_ground_truth(tracks, ground_truth):
             else:
                 N = T.shape[1]
             # Only compare times present in both ground truth and estimate
-            rmse = np.sum((T[:, t[t<N]]-x[:2, t[t<N]])**2)/N
+            rmse = np.sqrt(np.sum((T[:, t[t<N]]-x[:2, t[t<N]])**2)/N)
             if rmse < ormse: # The ground truth with the lowest to track RMSE is assumed to be correct
-                matches[track['identity']] = key
+                if rmse < 100: # If the rmse is too large, assume it is a false match
+                    matches[track['identity']] = key
                 ormse = rmse
     return matches
 
-- 
GitLab