Analyzing gaze data from watching movies to determine the percentage of gaze locations on faces in each frame
Save the video file and gaze data file to the same directory as face_detection.py. The gaze data file must have the headers:
frame_num shot_num x y timestamp subject eyetracker_valid in_frame subject_valid_for_clip film
To extract the frames from the video file, you can run
ffmpeg -i myclip.mp4 'path/to/where/i/want/frames/myclip_%d.jpg'
Ensure that all of the file names only contain a single number that corresponds to the frame number in the gaze data. Do not include any other numbers in the name. Note that using %d numbers all of the frames appropriately except for the first one. You might have to manually add "_0" to the file name.
pip install -r requirements.txt
Run face_detector.py
To get the percentage of gaze locations for each frame, run
plot_percentages(frames_directory, data_file_path, film_name)
This will save a csv file to your directory and will create a plot of the data.
To view where the bounding boxes on a frame are, run
detect_faces(frame_path, visualize=True)