Preprint
Article

This version is not peer-reviewed.

Dynamic Hirschberg: Camera-Based Temporal Sensing of Ocular Alignment Without Per-User Calibration

Submitted:

27 November 2026

Posted:

30 November 2026

You are already at the latest version

Abstract
Single-image alignment tests can miss deviations present only part of the time, as in intermittent strabismus. We present Dynamic Hirschberg (DH), a camera-based method measuring, in every video frame, the signed horizontal displacement between the pupil center and the corneal reflex of each eye, normalized by the iris diameter. Validity masks and a quality gate withhold a result when the measurement fails; no per-user calibration is required. Injected-reflex tests confirmed the sign convention; under image rescaling, the normalized signal showed coefficients of variation of approximately 2–4%, versus 35% for raw pixels. Classifiers were compared on 1500 synthetic 10-s sequences including gaze shifts and dropouts; shorter windows often missed intermittent episodes. Whole-sequence models reached weighted F1-scores up to 0.99, single-frame classifiers at most 0.55. A compact temporal convolutional network outperformed a CNN–BiLSTM (0.981 versus 0.876) with 66% fewer parameters and the best balance of accuracy, noise robustness and efficiency; handcrafted features deteriorated sharply beyond their training range. Of 13 stock videos, six yielded ten complete 10-s windows. The quality gate rejected eight windows that failed the predefined reflex-detection and measurement-validity criteria; both accepted windows originated from one strabismus video and were classified as constant deviation. Clinical validation remains necessary.
Keywords: 
;  ;  ;  ;  ;  ;  ;  ;  ;  
Subject: 
Engineering  -   Bioengineering

1. Introduction

Strabismus is a misalignment of the eyes in which the visual axes do not intersect at the point of fixation. It affects a substantial proportion of the population worldwide [1] and is among the most common binocular vision disorders of childhood. When misalignment arises during the sensitive period of visual development, it can impair binocular function and lead to amblyopia, reduced stereopsis and permanent visual loss [2]. Early detection of ocular misalignment is therefore a central goal of pediatric vision screening.
Clinical measurement of eye alignment has long relied on the geometry of the eye. The Hirschberg test estimates the direction and approximate size of a deviation from the position of the corneal light reflex relative to the center of the pupil [3]. Related reflex-based tests, such as the Brückner test, are widely used for quick screening of children because they need little or no instrumentation [4]. These tests, however, assess alignment at a single moment and do not consider how alignment changes over time.
Instrument-based photoscreeners extend this idea by estimating refractive error and alignment from a single photograph of both eyes, and they are now common in pediatric practice [5,6,7,8]. Their sensitivity is lower for small-angle and intermittent strabismus [9,10], and their accuracy depends on illumination, device settings, head position and the child’s cooperation [11]. Because a single image records only one instant, it can miss a deviation that is present only part of the time.
Computer vision methods for measuring ocular deviation from still images and short videos captured with consumer cameras and smartphones have been reported [12,13,14,15], including deep-learning methods that detect strabismus from facial photographs [14,16] and methods that automate the Hirschberg measurement itself [17]. These studies demonstrate that automated alignment screening is feasible, but most treat each image or frame independently and do not model the temporal behavior of alignment.
Interest in camera-based sensing of the eye has grown with telemedicine. Smartphones and portable imaging devices are increasingly used in community screening and tele-ophthalmology [18,19], extending eye care to areas with little access to specialists [20]. Recording conditions in these settings are far less controlled than in a clinic, with wide variation in illumination, head orientation and camera distance.
In parallel, deep neural networks have been applied to gaze estimation and eye tracking from video [21,22,23], and adding temporal context can suppress frame-level noise [22]. These models are designed to estimate where a person is looking rather than the geometric alignment relevant to binocular vision, and many require a calibration procedure or known camera parameters [24,25], which is impractical in unstructured screening.
Imaging geometry poses a further difficulty. The pixel displacement between the pupil center and the corneal reflex scales with camera distance, focal length and sensor resolution. High-end eye trackers compensate with calibration and controlled setups [26], but this is rarely possible in flexible settings. A common alternative is to normalize by a stable anatomical reference such as the iris diameter [21,27].
Ocular alignment is not constant. Even during steady fixation the eyes make small fixational movements [28], and in intermittent exotropia alignment alternates between aligned and deviated states over seconds [29]. A single photograph may therefore capture an unrepresentative state.
These observations motivate measuring alignment over a short time window. We propose the Dynamic Hirschberg (DH) method, which uses an ordinary camera as an optical sensor of ocular alignment: the signed, iris-normalized pupil–reflex displacement of both eyes is measured in every frame of a short video, failed measurements are flagged rather than replaced by zeros, and the resulting time series is classified only if enough of it is valid. We present DH as a temporal sensing methodology, not as a clinically validated diagnostic system. The contributions of this work are as follows:
  • A signed, horizontal, iris-normalized measurement of the pupil–corneal-reflex displacement of each eye with a mirror-invariant temporal sign convention, explicit validity masks and a quality gate with a “cannot assess” outcome, verified with injected reflexes and image rescaling;
  • A synthetic temporal sequence generator with conjugate gaze shifts, recovering and truncated intermittent episodes, deviation of either eye in either direction, overlapping class amplitudes and missing observations represented by masks, with noise matched to real measurements;
  • A controlled comparison, on identical data and over five training seeds, of single-frame, sequence-statistic and handcrafted-feature classifiers and of four neural architectures, in terms of accuracy, robustness, parameter count and latency;
  • An analysis of 13 real stock videos with the quality gate, which identifies the acquisition requirements for clinical use.
The remainder of the paper is organized as follows. Section 2 describes the measurement, its verification, the quality gate, the generator, the models and the evaluation protocol. Section 3 reports the results. Section 4 discusses their implications and limitations, and Section 5 concludes the paper.

2. Materials and Methods

2.1. Optical Sensing Principle

The anterior corneal surface acts as a convex mirror. A light source in front of the eye forms a small virtual image, the corneal reflex or glint, whose position depends mainly on the curvature of the cornea and the positions of the light source and camera. The pupil center, by contrast, moves with the rotation of the eye. When the eye rotates horizontally, the pupil center shifts relative to the glint, and for small rotations this shift is approximately proportional to the rotation angle. The Hirschberg test uses this relationship to estimate ocular deviation [3]. The constant of proportionality (the Hirschberg ratio) varies between individuals, and a non-zero offset is present even in a well-aligned eye because of angle kappa [30].
Two consequences shape the measurement used here. First, the displacement must be signed: an outward (exotropic) and an inward (esotropic) deviation move the pupil in opposite directions relative to the glint. Second, the displacement of one eye also changes when the person simply looks to one side. If each eye’s displacement is expressed in that eye’s temporal direction (Section 2.2), a horizontal gaze shift of both eyes changes the two values by approximately equal and opposite amounts, whereas a misalignment of one eye changes their sum. The binocular alignment index
A t = u t ( 1 ) + u t ( 2 )
is therefore designed to reduce the influence of conjugate horizontal gaze under approximately symmetric measurement conditions, that is, similar Hirschberg ratios and viewing geometry for the two eyes; real eyes, perspective and ocular asymmetries may violate this assumption. The index corresponds to the clinical practice of comparing the reflex positions of the two eyes.
The term without per-user calibration means that no calibration procedure and no knowledge of camera intrinsics or subject distance are required. The output is a dimensionless quantity that increases with eye rotation; it is not converted to an angle or to prism diopters, which would require the individual Hirschberg ratio. Normalization by the iris diameter is intended to remove the effect of image scale (camera distance and resolution); it does not compensate for head rotation or changes in illumination geometry.

2.2. Measurement Pipeline

Each video is resampled to 30 frames per second, taking the nearest frame in time. Each frame is processed with MediaPipe Face Mesh (version 0.10.14) with iris refinement enabled and a single face. For each eye e, the iris-center landmark (468 for one eye, 473 for the other) is taken as the pupil-center estimate p t ( e ) , and the iris diameter d ^ t ( e ) is the distance between the two horizontal iris-boundary landmarks (469–471 and 474–476).
The corneal reflex g t ( e ) is searched in a square window centered on p t ( e ) with half-width max ( 3 , 0.35 d ^ t ( e ) ) pixels, so that the window scales with image size. The window is converted to grayscale and smoothed with a 3 × 3 Gaussian filter. If its maximum grey level is at least τ = 200 , the reflex is taken as the centroid of the pixels within two grey levels of the maximum; this gives a sub-pixel estimate that is unaffected by ties when the reflex is saturated. The signed displacement is
u t ( e ) = s e p x , t ( e ) − g x , t ( e ) d ^ t ( e ) , s e = sign p x , t ( e ) − m x , t ,
where m x , t is the horizontal midpoint of the two iris centers. The factor s e makes the positive direction temporal for each eye: u > 0 means that the pupil center lies temporal to the reflex, as in exotropia, and u < 0 means nasal, as in esotropia. Because s e is defined from the face geometry, u does not change when the image is mirrored.
A frame is valid for an eye, v t ( e ) = 1 , only if the face is detected, d ^ t ( e ) > 0 and the reflex is found. For invalid frames, u t ( e ) is set to 0 and v t ( e ) = 0 ; the classifiers receive the masks as separate input channels, so a failed measurement is never presented as a genuine zero displacement. Because of the resampling, a fixed number of frames corresponds to the same duration for every camera. The input to a classifier is a window of T = 300 frames (10 s) with four channels ( u ( 1 ) , u ( 2 ) , v ( 1 ) , v ( 2 ) ) . The window length was chosen from a dedicated experiment comparing 2.5, 5 and 10 s (Section 2.8 and Section 3.7). A window must be long enough to contain an intermittent deviation episode, which in the generator lasts 0.8–4.5 s from onset to recovery (Section 2.5), together with aligned frames; when the label belongs to the subject, a shorter window frequently contains no episode at all. In that experiment, a 10-s window contained a deviation for almost all intermittent subjects under the frequent-episode scenario, whereas a 5-s window missed about one-third of them. A 10-s recording is still short enough to be obtained while a child looks at a fixation target, and its processing remains faster than real time. Even a 10-s window cannot exclude a deviation that occurs only rarely (Section 3.7). The workflow is summarized in Figure 1.

2.3. Measurement Verification

The measurement was checked on frames of the real video with the most valid measurements (Section 2.9):
  • Sign and magnitude: a 3 × 3 white test reflex was drawn 2, 3 or 4 pixels temporal or nasal of the pupil center of each eye in 30 frames, and the measured u was compared with the expected value. Because positive u denotes the temporal direction (Equation (2)), a reflex placed k pixels temporal of the pupil center puts the pupil nasal of the reflex, so the expected value is u = − k / d ^ ; a reflex placed k pixels nasal gives u = + k / d ^ .
  • Mirror invariance: each frame was flipped horizontally and measured with the landmark coordinates mirrored exactly, isolating the sign convention from landmark detection; in addition, the landmarks were re-detected on the flipped frames to quantify the effect of landmark variability.
  • Scale normalization: the video was rescaled digitally by factors of 0.5, 0.75, 1, 1.5 and 2, and the median raw pixel displacement and median normalized displacement u were compared across scales using the coefficient of variation.
In addition, the frame-to-frame localization noise of u was estimated from consecutive valid frames of the real videos with at least 50% jointly valid frames, using the robust estimate σ ^ = 1.4826 MAD ( Δ u ) / 2 .

2.4. Quality Gate

A window is classified only if both eyes are jointly valid in at least a fraction q of its frames and the longest run of jointly invalid frames does not exceed g frames; otherwise the output is “cannot assess” with the reason. The default values q = 0.7 and g = 15 frames (0.5 s) are provisional engineering settings, chosen before the real videos were analyzed: a gap of 0.5 s accommodates a normal blink, while longer gaps could hide an episode of deviation. The gate does not verify that a detected bright region is a genuine corneal reflex; it only checks that the predefined detection and validity criteria are met. Its effect was evaluated for several settings of q and g on synthetic data with the recommended CNN-only network and the CNN–BiLSTM (Section 2.8), and the real videos were analyzed with three settings.

2.5. Synthetic Temporal Sequence Generator (STSG)

Annotated videos of intermittent strabismus suitable for training are, to our knowledge, not publicly available, so labeled sequences were produced with a generator. Its purpose is not to reproduce the clinical presentation of strabismus exactly but to produce temporal patterns with the characteristic structure of each class, while preventing simple shortcuts. Each sequence contains the signed displacement and validity mask of both eyes over 300 frames (10 s), composed as follows; event counts are specified per 5 s and summed over the two halves of the window (Table 1):
  • a per-eye baseline offset representing angle kappa;
  • conjugate gaze: a piecewise-constant horizontal gaze level with 0–3 shifts per 5 s and slow head drift, entering the two eyes with opposite signs;
  • small independent fixational drift of each eye;
  • for the affected eye, chosen at random, a deviation of random sign (exo or eso): none for Healthy; a persistent offset for Constant; and for Intermittent, one or two trapezoidal episodes per 5 s with onset, plateau and recovery phases, which may begin before or end after the window, with at least 20 aligned and 20 deviated frames inside the window;
  • Gaussian localization noise with a standard deviation drawn per sequence from the range measured on real videos (Section 3.1);
  • missing observations from blinks of both eyes, random per-eye dropout and dropout bursts, represented by the masks.
The amplitude ranges of the Intermittent and Constant classes overlap, so the classes differ in temporal structure rather than amplitude. The dataset contains 1500 sequences (500 per class; 13.3% of eye-frames missing). Examples are shown in Figure 2. The parameter values other than the noise level were chosen by the authors, not estimated from clinical recordings.

2.6. Classification Models

Four neural networks were compared (Figure 3). Three share a convolutional front end (one-dimensional convolution with 64 filters, kernel size 5 and ReLU, max pooling by 2 and dropout 0.3) and a head consisting of a 32-unit ReLU dense layer and a three-class softmax layer:
  • CNN–BiLSTM (71,619 parameters): a bidirectional LSTM with 64 units per direction after the front end;
  • CNN-only (24,067 parameters): a second convolutional layer (64 filters, kernel 5) and global average pooling, i.e., a purely convolutional temporal network;
  • CNN–Transformer (46,467 parameters): learned positional embeddings, one Transformer encoder block (4 heads, key dimension 16, feed-forward width 128, layer normalization) and global average pooling.
The fourth, BiLSTM-only (39,555 parameters), applies the bidirectional LSTM directly to the input. Classical baselines (logistic regression, a support vector machine with RBF kernel and a random forest with 300 trees) were applied to three feature sets computed from valid frames only: (i) a single frame, the values u ( 1 ) , u ( 2 ) and A at the jointly valid frame nearest the middle of the window, representing a snapshot test; (ii) sequence statistics, the mean and standard deviation of u ( 1 ) , u ( 2 ) and A; and (iii) handcrafted temporal features, for each of these three signals the mean, standard deviation, minimum, maximum, mean of each third of the window, linear slope, maximum absolute frame-to-frame change and 10–90% percentile range. All features were computed from valid frames only; a feature that could not be computed because no valid frame was available was set to 0. Features were standardized to zero mean and unit variance on the training set for logistic regression and the support vector machine; the random forest used unstandardized features.

2.7. Training Procedure

The 1500 sequences were divided with a stratified split (seed 42) into training (1050), validation (225) and test (225; 75 per class) sets. The test set was used only for the final evaluation. All networks were trained with the Adam optimizer (learning rate 10 − 3 ), batch size 32 and sparse categorical cross-entropy, for at most 100 epochs with early stopping on the validation loss (patience 10, restoring the best weights), each with five random seeds (0–4). The classical baselines were trained on the same training set with the same seeds.

2.8. Evaluation Protocol

  • Classification: all models were evaluated on the held-out test set (accuracy, macro-averaged and support-weighted F1-score; per-class precision, recall and F1-score pooled over seeds).
  • Input ablation: the recommended CNN-only network and, for comparison, the CNN–BiLSTM were retrained (five seeds each) with (i) the binocular index A and the joint mask only; (ii) u ( 1 ) , u ( 2 ) without masks; (iii) the default four channels; and (iv) the default channels plus masked first- and second-order frame-to-frame differences.
  • Robustness: all five seed models of each network and the five handcrafted-feature random forests were frozen and tested on freshly generated sets (100 sequences per class; five sets per condition with generator seeds 5000–5004), giving 25 evaluations per model and condition. The conditions were nominal settings; localization noise of SD 0.03, 0.05 and 0.08 (above the training range); per-eye dropout of 30%; large gaze shifts (±0.3 with 1–4 shifts); and low-amplitude deviations (0.04–0.08, below the training range).
  • Selective classification with the quality gate: all five seed models of the recommended CNN-only network and of the CNN–BiLSTM were applied to 600 fresh synthetic sequences of variable recording quality (200 per class; per-eye dropout rate U ( 0 , 0.5 ) , dropout bursts with probability 0.5, 0–4 blinks; median 46% jointly valid frames, interquartile range 37–57%). For each gate setting, we report the numbers of accepted and rejected windows, the coverage (accepted windows divided by all 600 windows), the class distribution of accepted windows, and the weighted F1-score of accepted and of rejected windows as mean ± SD over the five seed models. Because the gate does not depend on the model, the counts are identical across seeds. Metrics are reported as undefined when no window is accepted and flagged when any class has fewer than 10 accepted windows. To evaluate all seeds, the models were retrained with identical settings; the retrained models reproduced the reported test-set predictions exactly (agreement 100% for all ten models).
  • Latency: classifier latency, the mean inference time for one window (batch size 1) of the compiled model graph over 300 calls after warm-up; and end-to-end processing time per frame (video decoding, MediaPipe and reflex localization) measured on 600 frames of a real video. Both were measured on the CPU of the workstation described below.
  • Observation-window length: in the generator described above, every Intermittent window contains a deviation by construction, so the label is always visible. To choose the window length, a subject-level variant was used in which the label belongs to the subject and the window is a crop of a longer recording. For each synthetic subject, a 20-s (600-frame) recording was generated with the same components and parameter ranges as Table 1, with gaze shifts, blinks and dropout bursts scaled to the recording length. For Intermittent subjects, deviation episodes of the same shape alternated with aligned intervals of random duration, starting at a random phase: 1–10 s in the frequent scenario and 5–20 s in the infrequent scenario. One window of 75, 150 or 300 frames (2.5, 5 or 10 s) was cropped from each recording at a random position. A window was considered to show the deviation if at least 20 of its frames were deviated by more than half of the episode amplitude, the criterion used in the generator. For each window length, the CNN-only network was trained with five seeds on 1500 subjects (frequent scenario, same split and training settings as above) and tested on 600 fresh subjects (200 per class) of each scenario. Both scenarios are assumptions: the actual frequency of deviation episodes varies between patients and with fatigue and attention, and was not estimated from data.

2.9. Real-Video Analysis

The method was applied to 13 short facial stock videos obtained from Dreamstime (https://www.dreamstime.com) under its Standard Content License: all 7 clips labeled Normal and all 6 labeled Strabismus in the authors’ collection, according to the descriptions of the clips. No clips were excluded. The labels have not been verified clinically and do not specify the type of strabismus, so no accuracy was computed. The videos were 580 pixels wide and 306–326 pixels high, recorded at 24–60 frames per second and 5.4–32.9 s long. Each was resampled to 30 frames per second by selecting the frame nearest to each 1/30-s time point (so frames were repeated in clips recorded below 30 frames per second and skipped in faster clips), measured as in Section 2.2 and divided into non-overlapping 300-frame (10-s) windows. Seven clips were shorter than 10 s and yielded no window, so 10 windows from six clips were analyzed. Each window was passed through the quality gate, and accepted windows were classified by the seed-0 models. For each clip, the median iris diameter, the median peak grey level in the reflex search window, and the percentage of frames valid in each eye and in both eyes were recorded. Processing was performed locally, and only numerical values were stored.

2.10. Implementation

The experiments were run with Python 3.11.18, TensorFlow 2.16.2 (Keras 3.15.1), scikit-learn 1.5.2, OpenCV 4.10 and MediaPipe 0.10.14 on an Apple M4 workstation. The code, the generator, the synthetic data, saved predictions and models, and the scripts that produce every table and figure are available at https://github.com/kwattana-lek/dynamic-hirschberg.

3. Results

3.1. Measurement Verification and Scale Normalization

In all 360 injected-reflex cases, the measured displacement had the expected sign and its error was 0 to numerical precision. With exactly mirrored landmarks, the measurement on flipped frames matched the original in all 49 eye-frames (maximum difference 3 × 10 − 15 ). When the landmarks were re-detected on the flipped frames, the median difference was 0.07 iris diameters, which reflects variability of the MediaPipe landmarks rather than of the sign convention.
Table 2 shows the rescaling test. Between scales 0.75 and 2 (iris diameter 17–48 pixels), the raw pixel displacement changed by a factor of about 2.5 (coefficient of variation 0.35 for both eyes), whereas the normalized displacement changed little (coefficient of variation 0.017 and 0.044). At scale 0.5 (iris diameter about 11 pixels) the reflex was detected in only 20–27% of frames and the normalized value was biased. In this video, therefore, measurements became unreliable at an iris diameter of about 11 pixels; a general minimum usable iris size cannot be established from one video. The robust frame-to-frame noise of u in the two videos with at least 50% valid frames was 0.006–0.014 iris diameters, which lies within the noise range of the generator.

3.2. Classification Performance

Table 3 summarizes the networks on the held-out test set. The CNN–Transformer (weighted F1 0.983 ± 0.005) and the CNN-only network (0.981 ± 0.005) were the most accurate; the per-class F1-scores of the CNN-only network were 0.972 (Healthy), 0.987 (Intermittent) and 0.985 (Constant). The networks with recurrent layers trained less reliably on the 10-s windows: the CNN–BiLSTM reached 0.876 ± 0.081, with seeds ranging from 0.78 to 0.99, and the BiLSTM-only network 0.681 ± 0.167. The CNN-only network had 66% fewer parameters than the CNN–BiLSTM and 16 times lower classifier latency. Figure 4 shows the confusion matrix of the CNN-only network; the most frequent errors were Intermittent sequences predicted as Healthy (9) and Healthy sequences predicted as Constant (8).

3.3. Static Versus Temporal Analysis

Classifiers given a single frame reached weighted F1-scores of 0.24–0.55 (Table 4) and recalled only 8–37% of Intermittent sequences, because at a single instant many of them are aligned. Whole-window features were far better: sequence statistics and handcrafted temporal features with a support vector machine or random forest reached 0.978–0.991, comparable to or slightly above the best networks. Under the nominal synthetic conditions, therefore, the decisive factor is observing alignment over time, not the particular classifier.

3.4. Input Ablation

For the CNN-only network, supplying the validity masks improved the weighted F1-score from 0.970 ± 0.014 to 0.981 ± 0.005 and reduced its variability between seeds (Table 5), consistent with telling the network which values are missing rather than giving it zeros; the gain was small on these data. The binocular index with the joint mask was almost as accurate (0.980 ± 0.002), and adding frame-to-frame differences did not help (0.970 ± 0.026). For the CNN–BiLSTM, every configuration varied widely between seeds (0.876–0.921, SD 0.04–0.08), so its ablation is inconclusive.

3.5. Robustness

Table 6 compares all models under identical frozen-model conditions. On fresh nominal data, the CNN-only and CNN–Transformer networks and the random forest reached 0.978–0.991, the CNN–BiLSTM 0.864 and the BiLSTM-only network 0.694. Their behavior diverged under conditions outside the training range:
  • Localization noise: the handcrafted-feature random forest collapsed to about 0.17 as soon as the noise exceeded the training range ( SD = 0.03 ), because its features scale with noise. The CNN–Transformer fell to 0.760 at SD 0.05. The CNN-only network scored highest at SD 0.03 and 0.05 (0.979 and 0.966); at SD 0.08 it and the CNN–BiLSTM both reached 0.773.
  • Missing frames: with 30% dropout, the random forest, whose features are computed from valid frames only, remained at 0.990; among the networks, the CNN-only network was the most tolerant (0.907), followed by the CNN–Transformer (0.825), whereas the CNN–BiLSTM fell to 0.652.
  • Large gaze shifts: the CNN-only and CNN–Transformer networks and the random forest remained above 0.92; the CNN–BiLSTM fell to 0.813.
  • Low-amplitude deviations: all models degraded, to 0.41–0.66.
No single model was best in every condition. The CNN-only network offered the best overall balance of classification performance, robustness to localization noise, model complexity and computational efficiency, and we therefore recommend it as the default; this does not mean that it is superior in every condition.

3.6. Selective Classification with the Quality Gate

Table 7 shows the effect of the gate on 600 synthetic windows of variable quality. Without the gate, the CNN-only network reached a weighted F1-score of 0.846 ± 0.022. As the minimum fraction of jointly valid frames q increased, the accepted windows were classified more accurately, but fewer windows were accepted: 0.925 ± 0.009 at q = 0.5 (80 windows, 13.3% coverage) and 0.954 ± 0.009 at q = 0.6 (48 windows, 8.0%). Rejected windows scored 0.83–0.85. Coverage was low because this test set was deliberately degraded (median 46% jointly valid frames) and because a 10-s window is more likely than a short one to contain a gap longer than g. At q = 0.7 only 19 windows were accepted with g = 15 and 39 with g = 30 , with fewer than 10 windows in at least one class, so the estimates of 1.000 and 0.980 are imprecise; at q = 0.8 only 6 windows were accepted and at q = 0.9 none, so these settings cannot be evaluated. The CNN–BiLSTM showed the same trend with lower scores and much larger between-seed variability. Because missing frames in the synthetic data occur at random, even rejected windows were classified reasonably well; in real recordings, measurement failures are typically systematic, and their effect is shown in Section 3.8. The default gate ( q = 0.7 , g = 15 ) therefore favors reliability over coverage, and q = 0.5 – 0.6 is a reasonable alternative when coverage matters more. The selected default thresholds are provisional engineering settings rather than clinically optimized operating points; appropriate thresholds should be established using recordings acquired under the intended screening protocol.

3.7. Observation-Window Length

When the label belonged to the subject rather than to the window, the window length had a large effect (Table 8). In the frequent scenario, only 43.5% of the 2.5-s windows of Intermittent subjects showed a deviation, compared with 67.5% of the 5-s windows and 96.5% of the 10-s windows, and the weighted F1-score of the CNN-only network rose from 0.737 ± 0.008 to 0.856 ± 0.007 and 0.956 ± 0.002. When a 5-s window showed the deviation, 93.0% of these windows were classified as Intermittent, close to the value for 10-s windows (96.6%), whereas only 76.1% were recognized in 2.5-s windows. Windows of Intermittent subjects that showed no deviation were mostly classified as Healthy (84.6% at 5 s), as expected, because they contain no evidence of misalignment. In the infrequent scenario, a 5-s window showed the deviation for only 41.5% of Intermittent subjects, and Intermittent recall fell to 0.416 at 5 s and 0.623 at 10 s. Recall of the Constant class (0.93–0.96) depended little on the window length, and Healthy recall increased from 0.85 at 2.5 s to 0.98 at 10 s. Classifier latency was 0.10–0.14 ms per window for all lengths. On the basis of these results, the 10-s window was adopted for all other experiments.

3.8. Real Videos

Table 9 summarizes the 13 videos. MediaPipe detected the face in all frames of 12 videos and in 74% of the frames of one, but a region meeting the reflex-detection criterion was found in both eyes in a usable fraction of frames in only two videos (Strabismus 1, 53.5%; Strabismus 6, 89.7%). In the other 11 videos, the median peak grey level in the search window was 78–174, below the detection threshold, so in most frames no region met the reflex-detection criterion. Several videos also had small iris diameters (8–15 pixels).
Seven clips were shorter than 10 s and could not be analyzed. With the default gate, 8 of the remaining 10 windows were reported as “cannot assess”: all 3 windows of the Normal videos and 5 of the 7 windows of the Strabismus videos. Seven were rejected because too few frames were jointly valid (0–54%), and one Strabismus 6 window because of a 20-frame gap. Without the gate, the CNN–BiLSTM would have assigned a class to every one of these windows, including Intermittent to two windows that contained no valid frame. Both accepted windows came from Strabismus 6 and were classified as Constant by the CNN-only, CNN–BiLSTM and BiLSTM-only networks and as Intermittent by the CNN–Transformer; their median binocular index was − 0.22 and − 0.23 , i.e., a persistent esotropic offset (Figure 5). Whether the bright regions detected in the accepted windows are genuine corneal reflexes was not verified by manual annotation. The single Strabismus 1 window had only 54% jointly valid frames and was rejected; its valid frames illustrate the role of the binocular index: the two eyes were displaced by similar amounts in opposite directions, and the median binocular index was 0.02, consistent with a horizontal gaze direction rather than misalignment. With a more lenient gate ( q = 0.5 , g = 30 ), the first Strabismus 6 window was also accepted (CNN-only and CNN–Transformer, Intermittent; CNN–BiLSTM and BiLSTM-only, Constant); with a stricter gate ( q = 0.9 , g = 15 ), the same two windows were accepted as with the default gate.

4. Discussion

This study asked whether the geometric principle of the Hirschberg test can be turned into a temporal measurement with an ordinary camera, and what is needed to interpret that measurement. The experiments are methodological and the classification results come from synthetic data; they establish technical feasibility and identify requirements for clinical work, but not diagnostic accuracy.

4.1. Measurement Validity

The measurement was made signed and horizontal, and its sign convention was defined from the face geometry. The injected-reflex and mirroring tests confirmed that it behaves as intended, and the rescaling test showed that iris normalization removed most of the effect of image scale over iris diameters of about 17–48 pixels. Expressing each eye’s displacement in its temporal direction has a further benefit: conjugate gaze shifts appear with opposite signs in the two eyes, so the binocular index reduces their influence when the two eyes are measured approximately symmetrically. This was visible in the valid frames of the real Strabismus 1 recording, where large displacements of the individual eyes corresponded to a binocular index near zero. These checks concern the measurement chain on video; they are not a physical validation with controlled camera distance, resolution, head pose and illumination, which remains to be done.

4.2. Temporal Versus Snapshot Analysis

The clearest result is the gap between single-frame and whole-window analysis. Single-frame classifiers reached weighted F1-scores of at most 0.55 and missed most intermittent sequences, whereas the models that used the whole 10-s window performed far better. This supports the central premise of the method: a deviation present only part of the time cannot be detected reliably from one instant [9,10], but becomes evident when alignment is observed over a short interval.
The window-length experiment extends this result to the duration of observation. Once a deviation was present in the window, 5 s was almost enough for the CNN-only network to recognize it (93% versus 97% at 10 s), whereas 2.5 s was clearly too short. The limiting factor was whether a deviation occurred during the observation at all: under the assumed episode frequencies, a single 5-s window contained no deviation for one-third to more than half of the Intermittent subjects, and such windows were classified as Healthy, which is consistent with their signal. This is why a 10-s window was adopted. Even 10 s did not show a deviation for one-third of the subjects in the infrequent-episode scenario. Combining several observation windows, for example by flagging a subject if any accepted window shows a deviation, may improve the probability of capturing intermittent deviations, but no multi-window decision rule was evaluated here; the optimal recording duration and window-aggregation strategy should be determined from episode frequencies observed in patients and require further clinical validation.

4.3. Choice of Classifier

Under nominal conditions, simple whole-window statistics with a random forest or support vector machine were at least as accurate as any network, and the random forest was also the most tolerant of missing frames. However, its features depend on the noise level, and its weighted F1-score deteriorated sharply when localization noise exceeded the training range, which is likely in uncontrolled recordings. Among the networks, the CNN–Transformer was as accurate as the CNN-only network on nominal data but less robust to elevated localization noise than the CNN-only network. The networks with recurrent layers trained unreliably on 10-s windows: the CNN–BiLSTM varied widely between seeds and was the least tolerant of missing frames, consistent with the difficulty of training recurrent networks on long sequences, whereas the CNN-only network was accurate and stable, scored highest at low and moderate noise, was the most tolerant of missing frames among the networks, and required 66% fewer parameters, with a 16-fold speedup in classifier inference compared with the CNN–BiLSTM. The CNN-only network therefore offered the best overall balance of classification performance, robustness to localization noise, model complexity and computational efficiency, and we recommend it as the default classifier for DH. It was not best in every condition: at the highest noise level it equaled the CNN–BiLSTM, and with large gaze shifts and low amplitudes the CNN–Transformer scored slightly higher. All models degraded for deviations smaller than those seen in training, which shows that the training distribution must cover the clinically relevant range of small deviations.

4.4. Acquisition Requirements and Quality Control

The real videos show that the method depends on a visible corneal reflex. In 11 of the 13 stock videos, which were not recorded for this purpose, no region met the reflex-detection criterion in most frames, and the iris was often only 8–15 pixels wide, close to the size at which the rescaling test showed unreliable measurements. Recordings for DH therefore need a deliberate point light source near the camera, such as the smartphone flashlight or a bright fixation target, and a resolution at which the iris spans several tens of pixels. The quality gate withheld classification for windows that did not satisfy the predefined reflex-detection and measurement-validity criteria, reporting “cannot assess” instead. Without it, the networks assigned a class to every window, including those with no valid measurement at all, which in screening would give unsupported results. Note that a window passing the gate is not thereby shown to contain a genuine reflex; the gate checks only the predefined criteria.

4.5. Deployment Considerations

All networks are small: the CNN-only classifier required 0.15 ms per 10-s window. The end-to-end processing time is dominated by the measurement: on the workstation CPU, video decoding, MediaPipe (1.8 ms) and reflex localization took 2.2 ms per frame in total, or about 0.66 s per 10-s window, roughly 15 times faster than real time. These timings were obtained on an Apple M4 CPU, so on-device processing on smartphones appears realistic but remains to be measured. Processing on the device also avoids transmitting facial video, which simplifies data protection. Benchmarking of converted models on mobile hardware remains to be done.

4.6. Clinical Implications

If validated clinically, the method could support low-cost screening with ordinary consumer cameras in tele-ophthalmology and community eye-care programs where specialist examination is scarce. Early detection matters because untreated strabismus in childhood can lead to amblyopia and loss of binocular function [2]. Because the measurement relies on the corneal reflex relative to the pupil, it should be less affected than whole-face image analysis by epicanthal folds or a wide nasal bridge, which can make a well-aligned child appear esotropic; this is the reason the clinical Hirschberg test is used to distinguish pseudostrabismus. Eyelid occlusion of the reflex or of the iris landmarks could, however, still affect the measurement. This advantage remains to be demonstrated in children.

4.7. Limitations

This study has several limitations. First, all classification metrics were obtained on synthetic data. Although the generator includes gaze shifts, recovering and truncated episodes, deviations of either eye in either direction, overlapping amplitudes and measured noise levels, its other parameters were chosen by the authors, and real performance may be lower.
Second, scale normalization was verified only by digital rescaling of one video. It was not tested with physical changes of camera distance, head pose or illumination, and it does not correct for perspective effects of head rotation.
Third, the reflex detection uses a fixed brightness threshold, and a bright region above the threshold was not independently confirmed to be the corneal reflex, because no manual or reference annotation was performed. The measurement is not converted to an angle; the individual Hirschberg ratio and angle kappa [30] limit the interpretation of the absolute value of u, although the binocular index reduces the effect of gaze direction under approximately symmetric measurement conditions.
Fourth, only horizontal deviations were modeled. Vertical and torsional deviations, alternating strabismus and nystagmus were not.
Fifth, in the main synthetic experiments each Intermittent window was constructed with at least 20 aligned and 20 deviated frames, so these results describe recognition of a deviation that is present in the window. The window-length experiment, on which the choice of a 10-s window is based, depends on assumed episode frequencies that were not measured in patients; with infrequent episodes, a single 10-s window often contains no deviation. A normal result for one 10-s window therefore cannot exclude intermittent strabismus, and the required recording length remains to be determined clinically. The longer window also reduced the number of real stock clips that could be analyzed from 13 to 6.
Sixth, the real-video analysis used 13 stock videos that were not recorded for this method, of which only two contained a usable reflex and only one yielded windows that passed the quality gate; their labels come from the stock descriptions and were not verified clinically. No expert-annotated clinical video was available, so sensitivity and specificity could not be estimated.

4.8. Future Directions

The next steps are to record videos under a defined acquisition protocol with a controlled light source; to validate the measurement physically across camera distances, resolutions, illumination levels and head orientations; to replace the fixed brightness threshold with an adaptive reflex detector; to estimate the remaining generator parameters, including the frequency of deviation episodes, from such recordings; and to determine from these the recording length and the rule for combining windows. A clinical video dataset annotated by experts with reference measurements, such as the prism cover test, is then needed to estimate sensitivity and specificity across age groups.

5. Conclusions

This study turned the Hirschberg principle into a temporal measurement from ordinary video: the signed, iris-normalized displacement between the pupil center and the corneal reflex of both eyes, recorded with validity masks and screened by a quality gate, without per-user calibration. Verification tests confirmed the sign convention and demonstrated approximate scale invariance under digital image rescaling. On synthetic data, whole-window analysis greatly outperformed single-frame analysis, and a compact temporal convolutional network offered the best overall balance of accuracy, robustness and efficiency, outperforming a CNN–BiLSTM with 66% fewer parameters. Windows shorter than 10 s often contained no intermittent episode, so a 10-s window was adopted; because even 10 s can miss infrequent episodes, combining several observation windows may improve the probability of capturing intermittent deviations, but the optimal recording duration and window-aggregation strategy require further clinical validation. The quality gate improved the reliability of accepted windows at the cost of coverage. On real stock videos, the quality gate withheld classification for windows that did not satisfy the predefined reflex-detection and measurement-validity criteria, and both accepted windows, from one strabismus video, were classified as a constant esotropic deviation by the recommended network. These findings support temporal sensing of ocular alignment as a basis for low-cost screening of intermittent strabismus, provided that a corneal reflex meeting the detection criteria is recorded, and they define the next requirements: a controlled acquisition protocol, physical validation of the measurement and a clinical study with expert reference measurements.

Author Contributions

Conceptualization, W.K., K.S. and C.W.; methodology, W.K., K.S., C.W. and A.Z.A.A.; software, W.K. and K.S.; validation, K.S., T.P., C.W. and A.Z.A.A.; formal analysis, W.K., T.P. and A.Z.A.A.; investigation, K.S. and T.P.; resources, W.K. and P.K.; data curation, K.S. and P.K.; writing—original draft preparation, W.K. and K.S.; writing—review and editing, W.K., T.P., C.W., A.Z.A.A. and P.K.; visualization, K.S. and T.P.; supervision, W.K. and C.W.; project administration, W.K.; funding acquisition, W.K. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded in part by Walailak University under the International Mobility Fund for Research Collaboration, and was carried out under the Reinventing University program, supported by the Ministry of Higher Education, Science, Research and Innovation, Thailand.

Institutional Review Board Statement

This study was conducted in accordance with the Declaration of Helsinki and was reviewed and granted exemption by the Human Research Ethics Committee of Walailak University as part of the project “Intelligent System for Gaze Analysis and Ocular Abnormality Screening Using Deep Learning Techniques on Secondary Datasets” (project no. WU-EC-EN-4-461-68; certificate of exemption WUEC-26-020-01; date of approval 15 January 2026). The approved protocol covers the secondary datasets used here, including the Dreamstime stock videos.

Data Availability Statement

The code, the synthetic sequence generator, the 1500 synthetic sequences, the trained models, the saved test predictions, the per-frame measurements of the 13 real videos with their Dreamstime clip identifiers, and the scripts that reproduce all tables and figures are openly available at https://github.com/kwattana-lek/dynamic-hirschberg under the MIT License. The videos themselves cannot be redistributed under the Dreamstime licence but can be obtained from Dreamstime using the identifiers listed in the repository.

Acknowledgments

During the preparation of this manuscript, the authors used ChatGPT (OpenAI, GPT-5.5 Thinking) for English language editing and Claude (Anthropic, Claude Opus 5.5) for language editing and for assistance in writing the analysis, plotting and verification scripts. These tools did not generate any data; all results were produced by the released scripts, which the authors checked and which reproduce every table and figure. No generative AI tool was used to create images, figures or a graphical abstract. The authors have reviewed and edited the output and take full responsibility for the content of this publication.

Conflicts of Interest

The authors declare no conflicts of interest. The funders had no role in the design of the study; in the collection, analyses, or interpretation of data; in the writing of the manuscript; or in the decision to publish the results.

Abbreviations

The following abbreviations are used in this manuscript:
BiLSTM Bidirectional long short-term memory
CNN Convolutional neural network
CV Coefficient of variation
DH Dynamic Hirschberg
LSTM Long short-term memory
MAD Median absolute deviation
RBF Radial basis function
ReLU Rectified linear unit
RF Random forest
SD Standard deviation
STSG Synthetic temporal sequence generator
SVM Support vector machine

References

  1. Hashemi, H.; Pakzad, R.; Heydarian, S.; Yekta, A.; Aghamirsalim, M.; Shokrollahzadeh, F.; Khoshhal, F.; Pakbin, M.; Ramin, S.; Khabazkhoob, M. Global and regional prevalence of strabismus: a comprehensive systematic review and meta-analysis. Strabismus 2019, 27, 54–65. [Google Scholar] [CrossRef] [PubMed]
  2. Borchert, M.S. Principles and techniques of the examination of ocular motility and alignment. In Walsh and Hoyt’s Clinical Neuro-Ophthalmology, 6th ed.; Miller, N.R., Newman, N.J., Eds.; Lippincott Williams & Wilkins: Philadelphia, 2005; Vol. 1, chapter 18, pp. 887–906. [Google Scholar]
  3. von Noorden, G.K.; Campos, E.C. Binocular Vision and Ocular Motility: Theory and Management of Strabismus, 6th ed.; Mosby: St. Louis, MO, USA, 2002. [Google Scholar]
  4. Gräf, M. The Brückner test revisited. In Pediatric Ophthalmology, Neuro-Ophthalmology, Genetics: Strabismus – New Concepts in Pathophysiology, Diagnosis, and Treatment; Lorenz, B., Brodsky, M.C., Eds.; Springer: Berlin, Heidelberg, 2010; pp. 113–124. Essentials in Ophthalmology. [Google Scholar] [CrossRef]
  5. Arnold, R.W.; Armitage, M.D. Performance of four new photoscreeners on pediatric patients with high risk amblyopia. J. Pediatr. Ophthalmol. Strabismus 2014, 51, 46–52. [Google Scholar] [CrossRef] [PubMed]
  6. Sanchez, I.; Ortiz-Toquero, S.; Martin, R.; De Juan, V. Advantages, limitations, and diagnostic accuracy of photoscreeners in early detection of amblyopia: a review. Clin. Ophthalmol. 2016, 10, 1365–1373. [Google Scholar] [CrossRef] [PubMed]
  7. Donahue, S.P.; Johnson, T.M.; Ottar, W.; Scott, W.E. Sensitivity of photoscreening to detect high-magnitude amblyogenic factors. J. Am. Assoc. Pediatr. Ophthalmol. Strabismus 2002, 6, 86–91. [Google Scholar] [CrossRef] [PubMed]
  8. Zhang, X.; Wang, J.; Li, Y.; Jiang, B. Diagnostic test accuracy of Spot and Plusoptix photoscreeners in detecting amblyogenic risk factors in children: a systemic review and meta-analysis. Ophthalmic Physiol. Opt. 2019, 39, 260–271. [Google Scholar] [CrossRef] [PubMed]
  9. Williams, T.; Morgan, L.A.; High, R.; Suh, D.W. Critical assessment of an ocular photoscreener. J. Pediatr. Ophthalmol. Strabismus 2018, 55, 194–199. [Google Scholar] [CrossRef] [PubMed]
  10. Ferreira, A.; Vieira, R.; Maia, S.; Miranda, V.; Parreira, R.; Menéres, P. Photoscreening for amblyopia risk factors assessment in young children: A systematic review with meta-analysis. Eur. J. Ophthalmol. 2023, 33, 92–103. [Google Scholar] [CrossRef] [PubMed]
  11. Ferreira, S.; Marinheiro, C.; Mateus, C.; Rodrigues, P.P.; Rodrigues, M.A.; Rocha, N. Overcoming challenges in Video-Based health monitoring: Real-World Implementation, Ethics, and data considerations. Sensors 2025, 25, 1357. [Google Scholar] [CrossRef] [PubMed]
  12. Cheng, W.; Lynn, M.H.; Pundlik, S.; Almeida, C.; Luo, G.; Houston, K. A smartphone ocular alignment measurement app in school screening for strabismus. BMC Ophthalmol. 2021, 21, 150. [Google Scholar] [CrossRef] [PubMed]
  13. Pundlik, S.; Tomasi, M.; Liu, R.; Houston, K.; Luo, G. Development and preliminary evaluation of a smartphone app for measuring eye alignment. Transl. Vis. Sci. Technol. 2019, 8, 19. [Google Scholar] [CrossRef] [PubMed]
  14. Lu, J.; Fan, Z.; Zheng, C.; Feng, J.; Huang, L.; Li, W.; Goodman, E.D. Automated strabismus detection for telemedicine applications. In arXiv; 2018. [Google Scholar] [CrossRef]
  15. Yarkheir, M.; Sadeghi, M.; Azarnoush, H.; Akbari, M.R.; Khalili Pour, E. Automated strabismus detection and classification using deep learning analysis of facial images. Sci. Rep. 2025, 15, 3910. [Google Scholar] [CrossRef] [PubMed]
  16. Huang, X.; Lee, S.J.; Kim, C.Z.; Choi, S.H. An automatic screening method for strabismus detection based on image processing. PLoS ONE 2021, 16, e0255643. [Google Scholar] [CrossRef] [PubMed]
  17. Karaaslan, Ş.; Kobat, S.G.; Gedikpınar, M. A new method based on deep learning and image processing for detection of strabismus with the Hirschberg test. Photodiagnosis Photodyn. Ther. 2023, 44, 103805. [Google Scholar] [CrossRef] [PubMed]
  18. Wong, D.S.; Alsaif, A.; Bender, L. The role of telemedicine in strabismus assessment: a narrative review and meta-analysis. Telemed. E-Health 2024, 30, e2240–e2255. [Google Scholar] [CrossRef] [PubMed]
  19. Dawson, E.; Kennedy, C.; Bentley, C.; Lee, J.; Murdoch, I. The role of telemedicine in the assessment of strabismus. J. Telemed. Telecare 2002, 8, 52–55. [Google Scholar] [CrossRef] [PubMed]
  20. Hunt, B.; Ruiz, A.J.; Pogue, B.W. Smartphone-based imaging systems for medical applications: a critical review. J. Biomed. Opt. 2021, 26, 040902. [Google Scholar] [CrossRef] [PubMed]
  21. Krafka, K.; Khosla, A.; Kellnhofer, P.; Kannan, H.; Bhandarkar, S.; Matusik, W.; Torralba, A. Eye tracking for everyone. In Proceedings of the Proceedings of the IEEE conference on computer vision and pattern recognition, 2016; pp. 2176–2184. [Google Scholar] [CrossRef]
  22. Wang, X.; Zhao, X.; Ren, J. A new type of eye movement model based on recurrent neural networks for simulating the gaze behavior of human reading. Complexity 2019, 2019, 8641074. [Google Scholar] [CrossRef]
  23. Karmi, R.; Mastouri, R.; Rahmany, I.; Khlifa, N. An Appearance-based VisionTransformer Network for Enhanced Gaze Estimation. Signal Image Video Process. 2025, 19, 742. [Google Scholar] [CrossRef]
  24. Ramanauskas, N.; Daunys, G.; Dervinis, D. Investigation of calibration techniques in video based eye tracking system. In Proceedings of the Computers Helping People with Special Needs (ICCHP 2008), Berlin, Heidelberg, 2008; Lecture Notes in Computer Science. Vol. 5105, pp. 1208–1215. [Google Scholar] [CrossRef]
  25. Blignaut, P. Fixation identification: The optimum threshold for a dispersion algorithm. Atten. Percept. Psychophys. 2009, 71, 881–895. [Google Scholar] [CrossRef] [PubMed]
  26. Holmqvist, K.; Nyström, M.; Andersson, R.; Dewhurst, R.; Jarodzka, H.; Van de Weijer, J. Eye Tracking: A Comprehensive Guide to Methods and Measures; Oxford University Press: Oxford, UK, 2011. [Google Scholar]
  27. Zhang, X.; Sugano, Y.; Fritz, M.; Bulling, A. Appearance-Based Gaze Estimation in the Wild. In Proceedings of the Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2015; pp. 4511–4520. [Google Scholar] [CrossRef]
  28. Martinez-Conde, S.; Macknik, S.L.; Hubel, D.H. The role of fixational eye movements in visual perception. Nat. Rev. Neurosci. 2004, 5, 229–240. [Google Scholar] [CrossRef] [PubMed]
  29. Ma, M.M.L.; Scheiman, M. Divergence excess and basic exotropia types of intermittent exotropia: a major review. Part 1: prevalence, classification, risk factors, natural history and clinical characteristics. Strabismus 2023, 31, 97–128. [Google Scholar] [CrossRef] [PubMed]
  30. Basmak, H.; Sahin, A.; Yildirim, N.; Saricicek, T.; Yurdakul, S. The angle kappa in strabismic individuals. Strabismus 2007, 15, 193–196. [Google Scholar] [CrossRef] [PubMed]
Figure 1. Overview of the DH workflow. (i) Measurement: the video is resampled to 30 frames per second, facial and iris landmarks are detected with MediaPipe Face Mesh, the pupil center and corneal reflex are localized, and the signed iris-normalized displacement and its validity are recorded per frame for each eye. (ii) The synthetic temporal sequence generator provides labeled 10-s sequences for training. (iii) Each 300-frame window passes the quality gate (Section 2.4); windows that fail are reported as “cannot assess” with the reason, and accepted windows are assigned to one of three alignment classes by the recommended CNN-only network (Section 2.6 compares alternatives). The output is an alignment class, not a clinical diagnosis.
Figure 1. Overview of the DH workflow. (i) Measurement: the video is resampled to 30 frames per second, facial and iris landmarks are detected with MediaPipe Face Mesh, the pupil center and corneal reflex are localized, and the signed iris-normalized displacement and its validity are recorded per frame for each eye. (ii) The synthetic temporal sequence generator provides labeled 10-s sequences for training. (iii) Each 300-frame window passes the quality gate (Section 2.4); windows that fail are reported as “cannot assess” with the reason, and accepted windows are assigned to one of three alignment classes by the recommended CNN-only network (Section 2.6 compares alternatives). The output is an alignment class, not a clinical diagnosis.
Preprints 246682 g001
Figure 2. Example synthetic sequences (signed normalized displacement; grey bands, frames in which at least one eye is invalid). (A) Healthy: conjugate gaze shifts (e.g., at about 4 and 5 s) move the two eyes by equal and opposite amounts, so their sum stays constant. (B) Intermittent: eye 2 deviates temporally in two episodes (about 0.5–2 s and 5–8.5 s) and recovers in between. (C) Constant: eye 1 is persistently deviated; at about 3 and 5.5 s conjugate gaze shifts move the two eyes in opposite directions while the deviation persists.
Figure 2. Example synthetic sequences (signed normalized displacement; grey bands, frames in which at least one eye is invalid). (A) Healthy: conjugate gaze shifts (e.g., at about 4 and 5 s) move the two eyes by equal and opposite amounts, so their sum stays constant. (B) Intermittent: eye 2 deviates temporally in two episodes (about 0.5–2 s and 5–8.5 s) and recovers in between. (C) Constant: eye 1 is persistently deviated; at about 3 and 5.5 s conjugate gaze shifts move the two eyes in opposite directions while the deviation persists.
Preprints 246682 g002
Figure 3. Neural architectures compared, with their numbers of trainable parameters. All receive the four-channel input (signed displacement and validity mask of both eyes) and share the same dense head.
Figure 3. Neural architectures compared, with their numbers of trainable parameters. All receive the four-channel input (signed displacement and validity mask of both eyes) and share the same dense head.
Preprints 246682 g003
Figure 4. Confusion matrix of the CNN-only network on the held-out synthetic test set, pooled over five training seeds (1125 predictions).
Figure 4. Confusion matrix of the CNN-only network on the held-out synthetic test set, pooled over five training seeds (1125 predictions).
Preprints 246682 g004
Figure 5. Signed normalized displacement of both eyes and the binocular index u ( 1 ) + u ( 2 ) in two real 10-s windows (grey bands: frames in which at least one eye is invalid). Left: Strabismus 6, an accepted window with a persistent negative (esotropic) binocular index and transient changes. Right: Strabismus 1, a window rejected by the quality gate (54% jointly valid frames); in its valid frames the two eyes are displaced in opposite directions by similar amounts, so the binocular index stays near zero, as expected for a horizontal gaze direction.
Figure 5. Signed normalized displacement of both eyes and the binocular index u ( 1 ) + u ( 2 ) in two real 10-s windows (grey bands: frames in which at least one eye is invalid). Left: Strabismus 6, an accepted window with a persistent negative (esotropic) binocular index and transient changes. Right: Strabismus 1, a window rejected by the quality gate (54% jointly valid frames); in its valid frames the two eyes are displaced in opposite directions by similar amounts, so the binocular index stays near zero, as expected for a horizontal gaze direction.
Preprints 246682 g005
Table 1. Parameters of the synthetic temporal sequence generator. Displacements are in iris-diameter units; U denotes a uniform distribution.
Table 1. Parameters of the synthetic temporal sequence generator. Displacements are in iris-diameter units; U denotes a uniform distribution.
Component Setting
Baseline offset (each eye) U ( − 0.01 , 0.05 )
Conjugate gaze level U ( − 0.15 , 0.15 ) , 0–3 shifts per 5 s (3-frame transitions), sinusoidal head drift (one cycle per 5 s) of amplitude U ( 0.001 , 0.01 ) ; + for eye 1, − for eye 2
Fixational drift (each eye) random walk, step SD 0.0007
Affected eye; direction eye 1 or 2 at random; exo (+) or eso (−) at random
Constant amplitude U ( 0.08 , 0.25 ) throughout the window, ±5% slow modulation
Intermittent 1–2 episodes per 5 s; amplitude U ( 0.08 , 0.20 ) ; onset 5–30, plateau 15–75, recovery 5–30 frames; start frame − 40 to 290 (truncation allowed); ≥20 aligned and ≥20 deviated frames
Localization noise Gaussian, SD U ( 0.005 , 0.02 ) per sequence
Missing observations 0–3 blinks per 5 s of both eyes (3–10 frames); per-eye dropout rate U ( 0 , 0.10 ) ; with probability 0.3 per 5 s a 5–20-frame burst per eye
Dataset 1500 sequences of 300 frames (500 per class), generator seed 2026
Table 2. Digital rescaling of the Strabismus 6 video: median iris diameter, raw signed pixel displacement and normalized displacement u over valid frames.
Table 2. Digital rescaling of the Strabismus 6 video: median iris diameter, raw signed pixel displacement and normalized displacement u over valid frames.
Eye 1 Eye 2
Scale Iris (px) Raw (px) u Iris (px) Raw (px) u
0.5 11.5 −3.91 −0.338 11.3 −3.95 −0.346
0.75 18.2 −2.32 −0.124 17.5 −1.77 −0.100
1.0 24.2 −3.02 −0.122 23.3 −2.12 −0.090
1.5 36.3 −4.45 −0.119 34.9 −3.14 −0.090
2.0 48.4 −5.93 −0.119 46.5 −4.29 −0.091
CV, scales 0.75–2 0.353 0.017 0.348 0.044
Table 3. Performance of the neural networks on the held-out synthetic test set (225 sequences; mean ± SD over five training seeds). Latency: one window, compiled graph, CPU.
Table 3. Performance of the neural networks on the held-out synthetic test set (225 sequences; mean ± SD over five training seeds). Latency: one window, compiled graph, CPU.
Model Parameters Accuracy Macro F1 Weighted F1 Latency (ms)
CNN–BiLSTM 71,619 0.877 ± 0.080 0.876 ± 0.081 0.876 ± 0.081 2.40
CNN-only 24,067 0.981 ± 0.005 0.981 ± 0.005 0.981 ± 0.005 0.15
BiLSTM-only 39,555 0.698 ± 0.172 0.681 ± 0.167 0.681 ± 0.167 4.43
CNN–Transformer 46,467 0.983 ± 0.005 0.983 ± 0.005 0.983 ± 0.005 0.46
Table 4. Weighted F1-score of classical classifiers on the same test set (mean ± SD over five seeds; deterministic classifiers have SD 0).
Table 4. Weighted F1-score of classical classifiers on the same test set (mean ± SD over five seeds; deterministic classifiers have SD 0).
Features Logistic Regression SVM Random Forest
Single frame 0.236 0.554 0.542 ± 0.011
Sequence mean/SD 0.690 0.978 0.987 ± 0.000
Handcrafted temporal 0.729 0.978 0.991 ± 0.003
Table 5. Input ablation, each configuration retrained with five seeds (weighted F1-score, mean ± SD).
Table 5. Input ablation, each configuration retrained with five seeds (weighted F1-score, mean ± SD).
Input Channels CNN-Only CNN–BiLSTM
Binocular index A + joint mask 2 0.980 ± 0.002 0.921 ± 0.070
u ( 1 ) , u ( 2 ) without masks 2 0.970 ± 0.014 0.908 ± 0.039
u ( 1 ) , u ( 2 ) + masks (default) 4 0.981 ± 0.005 0.876 ± 0.081
Default + first- and second-order differences 8 0.970 ± 0.026 0.890 ± 0.064
Table 6. Weighted F1-score of frozen models on freshly generated test sets (mean ± SD over five seed models × five test sets of 300 sequences). Training conditions: noise SD 0.005–0.02, dropout rate up to 0.10, gaze level up to ±0.15, amplitudes ≥0.08. Large gaze shifts: level ±0.3 with 1–4 shifts per 5 s.
Table 6. Weighted F1-score of frozen models on freshly generated test sets (mean ± SD over five seed models × five test sets of 300 sequences). Training conditions: noise SD 0.005–0.02, dropout rate up to 0.10, gaze level up to ±0.15, amplitudes ≥0.08. Large gaze shifts: level ±0.3 with 1–4 shifts per 5 s.
Test Condition CNN–BiLSTM CNN-only BiLSTM-only CNN–Transformer Handcrafted + RF
Nominal (fresh data) 0.864 ± 0.081 0.978 ± 0.009 0.694 ± 0.148 0.979 ± 0.012 0.991 ± 0.005
Noise SD 0.03 0.863 ± 0.082 0.979 ± 0.009 0.690 ± 0.152 0.976 ± 0.011 0.171 ± 0.005
Noise SD 0.05 0.852 ± 0.077 0.966 ± 0.013 0.684 ± 0.151 0.760 ± 0.085 0.167 ± 0.000
Noise SD 0.08 0.773 ± 0.092 0.773 ± 0.078 0.671 ± 0.146 0.488 ± 0.026 0.167 ± 0.000
Dropout 30% 0.652 ± 0.245 0.907 ± 0.028 0.660 ± 0.164 0.825 ± 0.077 0.990 ± 0.005
Large gaze shifts 0.813 ± 0.095 0.924 ± 0.018 0.658 ± 0.151 0.931 ± 0.016 0.989 ± 0.004
Low amplitude (0.04–0.08) 0.438 ± 0.095 0.582 ± 0.051 0.406 ± 0.048 0.605 ± 0.043 0.659 ± 0.024
Table 7. Selective classification on 600 synthetic 10-s windows of variable recording quality (200 per class). Coverage: accepted windows / 600. Weighted F1: mean ± SD over five seed models. † Fewer than 10 accepted windows in at least one class; estimate imprecise. n/a: undefined (no accepted windows).
Table 7. Selective classification on 600 synthetic 10-s windows of variable recording quality (200 per class). Coverage: accepted windows / 600. Weighted F1: mean ± SD over five seed models. † Fewer than 10 accepted windows in at least one class; estimate imprecise. n/a: undefined (no accepted windows).
CNN-only (Recommended) CNN–BiLSTM
q g Accepted/Rejected Coverage (%) Accepted H/I/C F1, Accepted F1, Rejected F1, Accepted
— — 600/0 100.0 200/200/200 0.846 ± 0.022 n/a 0.691 ± 0.179
0.5 15 80/520 13.3 29/23/28 0.925 ± 0.009 0.834 ± 0.026 0.800 ± 0.121
0.6 15 48/552 8.0 18/13/17 0.954 ± 0.009 0.836 ± 0.023 0.877 ± 0.098
0.7 15 19/581 3.2 8/7/4† 1.000 ± 0.000† 0.841 ± 0.022 0.958 ± 0.067†
0.7 30 39/561 6.5 12/19/8† 0.980 ± 0.011† 0.836 ± 0.024 0.862 ± 0.122†
0.8 15 6/594 1.0 3/2/1† 1.000 ± 0.000† 0.844 ± 0.022 0.920 ± 0.112†
0.9 15 0/600 0.0 0/0/0 n/a 0.846 ± 0.022 n/a
Table 8. Effect of the observation-window length (2.5, 5 and 10 s = 75, 150 and 300 frames; CNN-only network; label assigned to the subject; mean ± SD over five seeds; 600 test subjects per scenario). Shown: Intermittent windows in which the deviation is visible (≥20 frames deviated by more than half of the amplitude). Recall, shown: Intermittent recall in those windows. The infrequent scenario was not used for training.
Table 8. Effect of the observation-window length (2.5, 5 and 10 s = 75, 150 and 300 frames; CNN-only network; label assigned to the subject; mean ± SD over five seeds; 600 test subjects per scenario). Shown: Intermittent windows in which the deviation is visible (≥20 frames deviated by more than half of the amplitude). Recall, shown: Intermittent recall in those windows. The infrequent scenario was not used for training.
Frequent Episodes (Aligned Intervals 1–10 s) Infrequent (5–20 s)
Window (s) Shown (%) Weighted F1 Recall H Recall I Recall, Shown Shown (%) Recall I
2.5 43.5 0.737 ± 0.008 0.849 ± 0.059 0.467 ± 0.058 0.761 ± 0.027 23.0 0.309 ± 0.056
5 67.5 0.856 ± 0.007 0.954 ± 0.044 0.664 ± 0.038 0.930 ± 0.032 41.5 0.416 ± 0.049
10 96.5 0.956 ± 0.002 0.983 ± 0.012 0.932 ± 0.008 0.966 ± 0.008 66.5 0.623 ± 0.014
Table 9. Real-video analysis (13 Dreamstime clips; non-overlapping 10-s windows; default gate q = 0.7 , g = 15 ). Short: clip shorter than 10 s, no window. Peak grey: median of the maximum smoothed grey level in the reflex search window. Valid: frames with a reflex in both eyes. Classification: CNN-only network. Clip identifiers are listed in the repository.
Table 9. Real-video analysis (13 Dreamstime clips; non-overlapping 10-s windows; default gate q = 0.7 , g = 15 ). Short: clip shorter than 10 s, no window. Peak grey: median of the maximum smoothed grey level in the reflex search window. Valid: frames with a reflex in both eyes. Classification: CNN-only network. Clip identifiers are listed in the repository.
Video Native fps Iris (px) Peak Grey Valid (%) Windows Accepted Classification of Accepted Windows
Normal 1 30 8 102 0.0 short —
Normal 2 30 11 79 0.0 0/1 —
Normal 3 60 13 95 0.0 0/1 —
Normal 4 24 30 123 5.1 short —
Normal 5 30 25 126 0.0 short —
Normal 6 30 29 139 0.0 0/1 —
Normal 7 25 15 86 0.0 short —
Strabismus 1 25 24 205 53.5 0/1 —
Strabismus 2 24 20 174 0.0 short —
Strabismus 3 50 14 155 0.0 short —
Strabismus 4 60 49 159 0.0 short —
Strabismus 5 30 15 165 0.0 0/3 —
Strabismus 6 30 24 228 89.7 2/3 Constant (2/2)
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.
Copyright: This open access article is published under a Creative Commons CC BY 4.0 license, which permit the free download, distribution, and reuse, provided that the author and preprint are cited in any reuse.