diff options
author | Théo de la Hogue | 2023-07-28 15:23:38 +0200 |
---|---|---|
committer | Théo de la Hogue | 2023-07-28 15:23:38 +0200 |
commit | 47c792fb8a60e20491197a21b1bd329033576532 (patch) | |
tree | 7f0b416c470c56a82dd49c9b9095c9914d875957 | |
parent | a9323156c2d357d50ae755c57ea9f5265e731d3d (diff) | |
download | argaze-47c792fb8a60e20491197a21b1bd329033576532.zip argaze-47c792fb8a60e20491197a21b1bd329033576532.tar.gz argaze-47c792fb8a60e20491197a21b1bd329033576532.tar.bz2 argaze-47c792fb8a60e20491197a21b1bd329033576532.tar.xz |
Assing look processings times.
-rw-r--r-- | src/argaze/ArFeatures.py | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/src/argaze/ArFeatures.py b/src/argaze/ArFeatures.py index 349ad48..d4d016f 100644 --- a/src/argaze/ArFeatures.py +++ b/src/argaze/ArFeatures.py @@ -14,6 +14,7 @@ import os import importlib from inspect import getmembers import threading +import time from argaze import DataStructures, GazeFeatures from argaze.ArUcoMarkers import * @@ -459,6 +460,14 @@ class ArFrame(): scan_step_analysis = {} aoi_scan_step_analysis = {} + # Assess look processing times + times = { + 'gaze_movement_identifier': None, + 'aoi_matcher': None, + 'scan_step_analyzers':{}, + 'aoi_scan_step_analyzers': {} + } + # Catch any error exception = None @@ -467,9 +476,15 @@ class ArFrame(): # Identify gaze movement if self.gaze_movement_identifier: + # Store movement identification start date + identification_start = time.time() + # Identify finished gaze movement finished_gaze_movement = self.gaze_movement_identifier.identify(timestamp, self.__gaze_position) + # Assess movement identification time in ms + times['gaze_movement_identifier'] = (time.time() - identification_start) * 1e3 + # Valid and finished gaze movement has been identified if finished_gaze_movement.valid: @@ -478,9 +493,15 @@ class ArFrame(): # Update current fixation fixation = finished_gaze_movement + # Store aoi matching start date + matching_start = time.time() + # Does the fixation match an aoi? self.__update_looked_aoi_data(fixation) + # Assess aoi matching time in ms + times['aoi_matcher'] = (time.time() - matching_start) * 1e3 + # Append fixation to scan path if self.scan_path != None: @@ -491,13 +512,21 @@ class ArFrame(): aoi_scan_step = self.aoi_scan_path.append_fixation(timestamp, finished_gaze_movement, self.looked_aoi) - # Analyze aoi scan path + # Is there a new step? if aoi_scan_step and len(self.aoi_scan_path) > 1: for aoi_scan_path_analyzer_type, aoi_scan_path_analyzer in self.aoi_scan_path_analyzers.items(): + # Store aoi scan step analysis start date + aoi_scan_step_analysis_start = time.time() + + # Analyze aoi scan path aoi_scan_path_analyzer.analyze(self.aoi_scan_path) + # Assess aoi scan step analysis time in ms + times[aoi_scan_path_analyzer_type] = (time.time() - aoi_scan_step_analysis_start) * 1e3 + + # Store analysis aoi_scan_step_analysis[aoi_scan_path_analyzer_type] = aoi_scan_path_analyzer.analysis elif GazeFeatures.is_saccade(finished_gaze_movement): @@ -510,13 +539,22 @@ class ArFrame(): scan_step = self.scan_path.append_saccade(timestamp, finished_gaze_movement) - # Analyze aoi scan path + + # Is there a new step? if scan_step and len(self.scan_path) > 1: for scan_path_analyzer_type, scan_path_analyzer in self.scan_path_analyzers.items(): + # Store scan step analysis start date + scan_step_analysis_start = time.time() + + # Analyze aoi scan path scan_path_analyzer.analyze(self.scan_path) + # Assess scan step analysis time in ms + times[scan_path_analyzer_type] = (time.time() - scan_step_analysis_start) * 1e3 + + # Store analysis scan_step_analysis[scan_path_analyzer_type] = scan_path_analyzer.analysis # Append saccade to aoi scan path @@ -555,7 +593,7 @@ class ArFrame(): self.__look_lock.release() # Return look data - return fixation, scan_step_analysis, aoi_scan_step_analysis, exception + return fixation, scan_step_analysis, aoi_scan_step_analysis, times, exception def draw(self, image:numpy.array, aoi_color=(0, 0, 0)) -> Exception: """ |