Required python libraries in requirements.txt.
Can install them with pip install or better yet uv pip install
uv pip install -r requirements.txtDownload the SAM 2.1 checkpoint from here and place it in checkpoints/
- Place your video in
data/(multiple videos are not supported) - Generate masks from the notebook and name the masks. Example masks are stored in
notebooks/config/masks/which you will have to rename - Create a config file in
config/(seeconfig/example_config.jsonfor an example or modify the example config which is not recommended btw.) - Run the script
python process_video.py config/example_config.json --debug-output output/debug_frame.pngExample output: with the video 76-86 (2).mp4 we get the following output:
Saved 153 interaction events to output/interaction_log.csv
Total contact time per mouse/object:
mouse_left + left_bottom: 64.23 s
mouse_left + left_top: 69.89 s
mouse_right + right_bottom: 85.06 s
mouse_right + right_top: 25.33 s
Saved debug visualization to output/debug_frame.pngCSV outputs are in: output/interaction_log.csv with comma delimited values.
- Add a GUI for the config file
- Add a GUI for mask generation
- Multiple video support
- Improve mouse interaction tracking
MIT