Git Product home page Git Product logo

eye-contact-cnn's Introduction

eye-contact-cnn

This repository provides a deep convolutional neural network model trained to detect moments of eye contact in egocentric view. The model was trained on over 4 millions of facial images of > 100 young individuals during natural social interactions, and achives an accuracy comaprable to that of trained clinical human annotators.

Libraries used in our experiment

  • PyTorch 0.4.0
  • opencv 4.0.0
  • numpy 1.16.2
  • PIL 5.3.0
  • pandas 0.23.4
  • dlib 19.13.0 (optional if you want live face detection)

To run

with a webcam

python demo.py

on a video file

python demo.py --video yourvideofile.avi

on our sample video

Try this if you don't want to use dlib's face and instead test with pre-detected faces.

Comment out the first line of demo.py "import dlib" if you didn't install dlib.

python demo.py --video demo_video.avi --face demo_face_detections.txt

Demo video has been downloaded from here. I used this face detector to generate the face detection file.

Flags

  • --face: Path to pre-processed face detection file of format [frame#, min_x, min_y, max_x, max_y]. If not specified, dlib's face detector will be used.
  • -save_vis: Saves the output as an avi video file.
  • -save_text: Saves the output as a text file (Format: [frame#, eye_contact_score]).
  • -display_off: Turn off display window.
  • Hit 'q' to quit the program.

Notes

  • Output eye contact score ranges [0, 1] and score above 0.9 is considered confident.
  • To further improve the result, smoothing the output is encouraged as it can help removing outliers caused by eye blinks, motion blur etc.

Citation

Please cite this paper in any publications that make use of this software.

@article{chong2020,
 title={Detection of eye contact with deep neural networks is as accurate as human experts},
 url={osf.io/5a6m7},
 DOI={10.31219/osf.io/5a6m7},
 publisher={OSF Preprints},
 author={Chong, Eunji and Clark-Whitney, Elysha and Southerland, Audrey and Stubbs, Elizabeth and Miller, Chanel and Ajodan, Eliana L and Silverman, Melanie R and Lord, Catherine and Rozga, Agata and Jones, Rebecca M and et al.},
 year={2020}
}

Link to the paper: here

eye-contact-cnn's People

Contributors

ejcgt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

eye-contact-cnn's Issues

mac cuda cpu/gpu issue

Im trying to run this on an old macbook pro and keep running into this issue with cuda..
I have a GT 650M graphics card and according to CUDA's support page, it looks like it should run without issues.. but i've also heard before that most mac book pro's don't have a card that supports cuda and that pytorch therefore is installed by default without (for mac).. can you help me understand what to do ? is it my mac, should i upgrade to fix this? (link to cuda page: https://en.wikipedia.org/wiki/CUDA#GPUs_supported)

error code:

eye-contact-cnn % python3 demo.py --video /Users/jonasbjerg/noedit/input/test1.MP4
loading saved model weights
Traceback (most recent call last):
File "demo.py", line 184, in
run(args.video, args.face, args.model_weight, args.jitter, args.save_vis, args.display_off, args.save_text)
File "demo.py", line 101, in run
model = model_static(model_weight)
File "/Users/jonasbjerg/noedit/eye-contact-cnn/model.py", line 11, in model_static
snapshot = torch.load(pretrained)
File "/opt/anaconda3/lib/python3.8/site-packages/torch/serialization.py", line 593, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
File "/opt/anaconda3/lib/python3.8/site-packages/torch/serialization.py", line 772, in _legacy_load
result = unpickler.load()
File "/opt/anaconda3/lib/python3.8/site-packages/torch/serialization.py", line 728, in persistent_load
deserialized_objects[root_key] = restore_location(obj, location)
File "/opt/anaconda3/lib/python3.8/site-packages/torch/serialization.py", line 175, in default_restore_location
result = fn(storage, location)
File "/opt/anaconda3/lib/python3.8/site-packages/torch/serialization.py", line 151, in _cuda_deserialize
device = validate_cuda_device(location)
File "/opt/anaconda3/lib/python3.8/site-packages/torch/serialization.py", line 135, in validate_cuda_device
raise RuntimeError('Attempting to deserialize object on a CUDA '
RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.