deepvog

Pupil segmentation and gaze estimation using fully convolutional neural networks

https://github.com/pydsgz/deepvog

Science Score: 41.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 6 DOI reference(s) in README
  • Academic publication links
    Links to: arxiv.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (19.5%) to scientific vocabulary
Last synced: 10 months ago · JSON representation ·

Repository

Pupil segmentation and gaze estimation using fully convolutional neural networks

Basic Info
  • Host: GitHub
  • Owner: pydsgz
  • License: gpl-3.0
  • Language: Python
  • Default Branch: master
  • Size: 175 MB
Statistics
  • Stars: 174
  • Watchers: 9
  • Forks: 69
  • Open Issues: 22
  • Releases: 0
Created over 7 years ago · Last pushed over 3 years ago
Metadata Files
Readme License Citation

README.md

DeepVOG

DeepVOG is a framework for pupil segmentation and gaze estimation based on a fully convolutional neural network. Currently it is available for offline gaze estimation of eye-tracking video clips.

Citation

DeepVOG has been peer-reviewed and accepted as an original article in the Journal of Neuroscience Method (Elsevier). The manuscript is available open access and can be downloaded free of charge here. If you use DeepVOG or some part of the code, please cite (see bibtex):

Yiu YH, Aboulatta M, Raiser T, Ophey L, Flanagin VL, zu Eulenburg P, Ahmadi SA. DeepVOG: Open-source Pupil Segmentation and Gaze Estimation in Neuroscience using Deep Learning. Journal of neuroscience methods. vol. 324, 2019, DOI: https://doi.org/10.1016/j.jneumeth.2019.05.016

Release Notes

DeepVOG v1.1.4 (Date: 31-07-2019, latest)

Improvements: 1. Added --skip_existed flag for skipping the operation in --table mode if the output file already exists 2. Added --skip_errors flag for skipping the operation in --table mode and continue the next video if error is encountered. 3. Added --log_errors flag for logging the errors and tracebacks in a file for --table mode, when error is encountered. 4. Added --no_gaze flag for only pupil segmentation in --infer mode. 5. One more column (with_gaze) to fill in the input csv file for --table mode. It enables/disable gaze estimation in --table mode.

For details of command line arguments, see doc/documentation.md

Removed: 1. Text-based User Interface (TUI) is removed.

For release history, see RELEASE.md. Update from existing package can be done via directly copying the source code deepvog/ to your directory of installed DeepVOG module .

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

To run DeepVOG, you need to have a Python distribution (we recommend Anaconda) and the following Python packages:

numpy scikit-video scikit-image tensorflow-gpu keras As an alternative, you can use our docker image which already includes all the dependencies. The only requirement is a platform installed with nvidia driver and nvidia-docker (or nvidia runtime of docker).

Installation of Package

A step by step series of examples that tell you how to get DeepVOG running.
1. Installing from package

$ git clone https://github.com/pydsgz/DeepVOG (or you can download the files in this repo with your browser) Move to the directory of DeepVOG that you just cloned/downloaded, and type $ python setup.py install If it happens to be missing some dependencies listed above, you may install them with pip:
$ pip install numpy $ pip install scikit-video $ ... 2. It is highly recommended to run our program in docker. You can directly pull our docker image from dockerhub. (For tutorials on docker, see docker and nvidia-docker)

$ docker run --runtime=nvidia -it --rm yyhhoi/deepvog:v1.1.4 bash or $ nvidia-docker run -it --rm yyhhoi/deepvog:v1.1.4 bash

Removal of Package

Removal can be done by simply deleting the python package, for example: $ rm -r /usr/local/lib/python3.5/dist-packages/deepvog-1.1.2-py3.5.egg The exact path will depend on where you store your installed python package, and the version of deepvog and python.

Usage (Command-line interface)

The CLI allows you to fit/infer single video, or multiple of them by importing a csv table. They can be simply called by: $ python -m deepvog --fit /PATH/video_fit.mp4 /PATH/eyeball_model.json $ python -m deepvog --infer /PATH/video_infer.mp4 /PATH/eyeball_model.json /PATH/results.csv $ python -m deepvog --table /PATH/list_of_operations.csv DeepVOG first fits a 3D eyeball model from a video clip. Base on the eyeball model, it estimates the gaze direction on any other videos if the relative position of the eye with respect to the camera remains the same. It has no problem that you fit an eyeball model and infer the gaze directions from the same video clip. However, for clinical use, some users may want to have a more accurate estimate by having a separate fitting clip where the subjects perform a calibration paradigm.

In addition, you will need to specify your camera parameters such as focal length, if your parameters differ from default values. $ python -m deepvog --fit /PATH/video_fit.mp4 /PATH/eyeball_model.json --flen 12 --vid-shape 240,320 --sensor 3.6,4.8 --batchsize 32 --gpu 0 Please refer to doc/documentation.md for the meaning of arguments and input/output formats. Alternatively, you can also type $ python -m deepvog -h for usage examples.

Usage (As a python module)

For more flexibility, you may import the module directly in python. ```python import deepvog

Load our pre-trained network

model = deepvog.load_DeepVOG()

Initialize the class. It requires information of your camera's focal length and sensor size, which should be available in product manual.

inferer = deepvog.gazeinferer(model, focallength, videoshape, sensorsize)

Fit an eyeball model from "demo.mp4". The model will be stored as the "inferer" instance's attribute.

inferer.process("demo.mp4", mode="Fit")

After fitting, infer gaze from "demo.mp4" and output the results into "demo_result.csv"

inferer.process("demo.mp4", mode="Infer", outputrecordpath="demo_results.csv")

Optional

You may also save the eyeball model to "demo_model.json" for subsequent gaze inference

inferer.saveeyeballmodel("demo_model.json")

By loading the eyeball model, you don't need to fit the model again

inferer.loadeyeballmodel("demo_model.json")

```

Demo

Demo video is located at demo. After installing DeepVOG, you can move to that directory and run the following commands:

$ python -m deepvog --fit ./demo.mp4 ./demo_eyeball_model.json -v ./demo_visualization_fitting.mp4 -m -b 256 $ python -m deepvog --infer ./demo.mp4 ./demo_eyeball_model.json ./demo_gaze_results.csv -b 32 -v ./demo_visualization_inference.mp4 -m

The -v argument draws the visualization of fitted ellipse and gaze vector to a designated video. The -m argument draws the segmented heatmap of pupil side by side. The -b argument controls the batch size. For more details of arguments, see doc/documentation.md.

In the results, you should be able to see the visualization in the generated video "demovisualizationinference.mp4", as shown below.

In addtion, you can also test out the --table mode by: $ python -m deepvog --table demo_table_mode.csv

Limitations

DeepVOG is intended for pupil segmentation and gaze estimation under the assumptions below:

  1. Video contains only single eye features (pupil, iris, eyebrows, eyelashes, eyelids...etc), for example the demo video. Videos with facial or body features may compromise its accuracy.
  2. DeepVOG was intended for eye video recorded by head-mounted camera. Hence, It assumes fixed relative position of the eye with respect to the camera.

For more detailed discussion of the underlying assumptions of DeepVOG, please refer to the paper.

Annotation tools

See annotation_tool/README.md.

Authors

  • Yiu Yuk Hoi - Implementation and validation
  • Seyed-Ahmad Ahmadi - Research study concept
  • Moustafa Aboulatta - Initial work

Links to other related papers

License

This project is licensed under the GNU General Public License v3.0 (GNU GPLv3) License - see the LICENSE file for details

Acknowledgments

We thank our fellow researchers at the German Center for Vertigo and Balance Disorders for help in acquiring data for training and validation of pupil segmentation and gaze estimation. In particular, we would like to thank Theresa Raiser, Dr. Virginia Flanagin and Prof. Dr. Peter zu Eulenburg.

DeepVOG was created with support from the German Federal Ministry of Education and Research (BMBF) in connection with the foundation of the German Center for Vertigo and Balance Disorders (DSGZ) (grant number 01 EO 0901), and a stipend of the Graduate School of Systemic Neurosciences (DFG-GSC 82/3).

Owner

  • Login: pydsgz
  • Kind: user

Citation (citations.bib)

@article{yiu2019deepvog,
  title={DeepVOG: Open-source Pupil Segmentation and Gaze Estimation in Neuroscience using Deep Learning},
  author={Yiu, Yuk-Hoi and Aboulatta, Moustafa and Raiser, Theresa and Ophey, Leoni and Flanagin, Virginia L and zu Eulenburg, Peter and Ahmadi, Seyed-Ahmad},
  journal={Journal of neuroscience methods},
  year={2019},
  publisher={Elsevier}
}

GitHub Events

Total
  • Watch event: 19
  • Fork event: 1
Last Year
  • Watch event: 19
  • Fork event: 1

Committers

Last synced: over 3 years ago

All Time
  • Total Commits: 63
  • Total Committers: 4
  • Avg Commits per committer: 15.75
  • Development Distribution Score (DDS): 0.492
Top Committers
Name Email Commits
yyhhoi y****i@g****m 32
yyhhoi 3****i@u****m 26
pydsgz 4****z@u****m 4
Alex Rothberg a****g@g****m 1

Issues and Pull Requests

Last synced: 11 months ago

All Time
  • Total issues: 24
  • Total pull requests: 2
  • Average time to close issues: 5 days
  • Average time to close pull requests: 3 minutes
  • Total issue authors: 21
  • Total pull request authors: 2
  • Average comments per issue: 1.42
  • Average comments per pull request: 0.5
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • Damon88888 (2)
  • lkh9908 (2)
  • mike-a-fischer (2)
  • lovescien (1)
  • mlper (1)
  • Sudhir-GuardEx (1)
  • shamanez (1)
  • Jialiang-Lu (1)
  • Jay2109 (1)
  • SophieChang66 (1)
  • Myzhencai (1)
  • dmardanbeigi (1)
  • Varshul (1)
  • gabriellamiles (1)
  • galrapo (1)
Pull Request Authors
  • cancan101 (1)
  • spokV (1)
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 23 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 5
  • Total maintainers: 1
pypi.org: deepvog

Deep VOG for gaze estimation

  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 23 Last month
Rankings
Forks count: 5.4%
Stargazers count: 6.1%
Dependent packages count: 10.1%
Average: 21.4%
Dependent repos count: 21.6%
Downloads: 63.8%
Maintainers (1)
Last synced: 11 months ago

Dependencies

setup.py pypi
  • keras >=2.2.4
  • numpy >=1.12
  • scikit-image >=0.14.0
  • scikit-video >=1.1.0
  • tensorflow-gpu >=1.12.0