  Pavlovian eyeblink conditioning is a powerful experiment used in the field of
neuroscience to measure multiple aspects of how we learn in our daily life. To
track the movement of the eyelid during an experiment, researchers have
traditionally made use of potentiometers or electromyography. More recently,
the use of computer vision and image processing alleviated the need for these
techniques but currently employed methods require human intervention and are
not fast enough to enable real-time processing. In this work, a face- and
landmark-detection algorithm have been carefully combined in order to provide
fully automated eyelid tracking, and have further been accelerated to make the
first crucial step towards online, closed-loop experiments. Such experiments
have not been achieved so far and are expected to offer significant insights in
the workings of neurological and psychiatric disorders. Based on an extensive
literature search, various different algorithms for face detection and landmark
detection have been analyzed and evaluated. Two algorithms were identified as
most suitable for eyelid detection: the Histogram-of-Oriented-Gradients (HOG)
algorithm for face detection and the Ensemble-of-Regression-Trees (ERT)
algorithm for landmark detection. These two algorithms have been accelerated on
GPU and CPU, achieving speedups of 1,753$\times$ and 11$\times$, respectively.
To demonstrate the usefulness of our eyelid-detection algorithm, a research
hypothesis was formed and a well-established neuroscientific experiment was
employed: eyeblink detection. Our experimental evaluation reveals an overall
application runtime of 0.533 ms per frame, which is 1,101$\times$ faster than
the sequential implementation and well within the real-time requirements of
eyeblink conditioning in humans, i.e. faster than 500 frames per second.
