Commit 9a1735a0 authored by pandersson's avatar pandersson
Browse files

Adds % correct guesses output

parent 51ef4d21
......@@ -22,17 +22,27 @@ def main():
# Check minimum and maximum value over time interval. Determine activity during time interval based on difference between these
time_interval = 2 # s
correct_guesses = 0
total_guesses = 0
for i in np.arange(0, len(acc)//freq - time_interval, time_interval):
acc_one_sec = acc[i * freq:(i + time_interval) * freq]
xMin = min(acc_one_sec)
xMax = max(acc_one_sec)
gt = ground_truth[int((2 * i + time_interval) * freq / 2.0)]
if xMax - xMin < still: # Some limit for still
print("At time: {}-{}, the person is - Still ({}, Diff: {:0.2f})".format(i, i + time_interval, ground_truth[int((2 * i + time_interval) * freq / 2.0)], xMax - xMin))
print("At time: {}-{}, the person is - Still ({}, Diff: {:0.2f})".format(i, i + time_interval, gt, xMax - xMin))
correct_guesses += int(gt == 'Still')
elif xMax - xMin < walk: # Some limit for walk
print("At time: {}-{}, the person is - Walking ({}, Diff: {:0.2f})".format(i, i + time_interval, ground_truth[int((2 * i + time_interval) * freq / 2.0)], xMax - xMin))
print("At time: {}-{}, the person is - Walking ({}, Diff: {:0.2f})".format(i, i + time_interval, gt, xMax - xMin))
correct_guesses += int(gt == 'Walking')
else:
print("At time: {}-{}, the person is - Running ({}, Diff: {:0.2f})".format(i, i + time_interval, ground_truth[int((2 * i + time_interval) * freq / 2.0)], xMax - xMin))
print("At time: {}-{}, the person is - Running ({}, Diff: {:0.2f})".format(i, i + time_interval, gt, xMax - xMin))
correct_guesses += int(gt == 'Running')
total_guesses += 1
print("#Correct guesses: {}, #Total guesses: {}, Correct%: {:.2f}".format(correct_guesses, total_guesses, correct_guesses / float(total_guesses) * 100))
if __name__ == "__main__":
main()
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment