|
@@ -0,0 +1,34 @@
|
|
|
+import csv
|
|
|
+import os
|
|
|
+import numpy as np
|
|
|
+
|
|
|
+sum_distance = 0
|
|
|
+counter = 0
|
|
|
+
|
|
|
+def vector_string_to_float(vector):
|
|
|
+ """
|
|
|
+ Convert vector string to float
|
|
|
+
|
|
|
+ Parameters:
|
|
|
+ vector: vector still in string
|
|
|
+ Returns:
|
|
|
+ vector: vector with type float
|
|
|
+ """
|
|
|
+ vector = vector.split(';')
|
|
|
+ vector = list(map(float, vector))
|
|
|
+ return vector
|
|
|
+
|
|
|
+path = os.path.join(os.getcwd(), 'Assets\\demo_and_body_positions.csv')
|
|
|
+print("path: ", path)
|
|
|
+with open(path, newline='') as csvfile:
|
|
|
+ reader = csv.reader(csvfile)
|
|
|
+ next(reader)
|
|
|
+ for row in reader:
|
|
|
+ for i in range(18):
|
|
|
+ demo = vector_string_to_float(row[i])
|
|
|
+ body = vector_string_to_float(row[i+18])
|
|
|
+ distance = np.linalg.norm(np.subtract(demo, body))
|
|
|
+ sum_distance += distance
|
|
|
+ counter += 1
|
|
|
+
|
|
|
+print("3d accuracy: ", sum_distance / counter)
|