Download GazeTracking/Blinks_pupil.py from DaMsTaR/Irregular_Eye_Movement: direct link, hf CLI and curl.
- Browser
- Download file 1.14 kB
-
https://huggingface.co/DaMsTaR/Irregular_Eye_Movement/resolve/main/GazeTracking/Blinks_pupil.py
- Command line
-
hf download hf://DaMsTaR/Irregular_Eye_Movement/GazeTracking/Blinks_pupil.py
-
curl -L -o Blinks_pupil.py https://huggingface.co/DaMsTaR/Irregular_Eye_Movement/resolve/main/GazeTracking/Blinks_pupil.py
1.14 kB
| import csv | |
| def analyze_gaze_data(csv_file): | |
| inconsistent_data = [] | |
| irregular_blinks = [] | |
| with open(csv_file, 'r') as csvfile: | |
| csv_reader = csv.reader(csvfile) | |
| next(csv_reader) # Skip header row | |
| for row in csv_reader: | |
| frame_count, gaze_direction, left_pupil, right_pupil = row | |
| # Check for inconsistencies in eye movement with pupil coordinates | |
| if gaze_direction != "Blinking": | |
| if left_pupil == "(None, None)" or right_pupil == "(None, None)": | |
| inconsistent_data.append(frame_count) | |
| # Check for irregular blinks | |
| if gaze_direction == "Blinking": | |
| irregular_blinks.append(frame_count) | |
| return inconsistent_data, irregular_blinks | |
| def main(): | |
| csv_file = 'fake_gaze_data.csv' | |
| inconsistent_data, irregular_blinks = analyze_gaze_data(csv_file) | |
| print("Inconsistent eye movement with pupil coordinates detected in frames:", inconsistent_data) | |
| print("Irregular blinks detected in frames:", irregular_blinks) | |
| if __name__ == "__main__": | |
| main() | |