Skip to main page content
U.S. flag

An official website of the United States government

Dot gov

The .gov means it’s official.
Federal government websites often end in .gov or .mil. Before sharing sensitive information, make sure you’re on a federal government site.

Https

The site is secure.
The https:// ensures that you are connecting to the official website and that any information you provide is encrypted and transmitted securely.

Access keys NCBI Homepage MyNCBI Homepage Main Content Main Navigation
. 2025 May;97(5):860-872.
doi: 10.1002/ana.27170. Epub 2025 Jan 9.

Automated Detection of Isolated REM Sleep Behavior Disorder Using Computer Vision

Affiliations

Automated Detection of Isolated REM Sleep Behavior Disorder Using Computer Vision

Mohamed Abdelfattah et al. Ann Neurol. 2025 May.

Abstract

Objective: Isolated rapid eye movement (REM) sleep behavior disorder (iRBD) is, in most cases, an early stage of Parkinson's disease or related disorders. Diagnosis requires an overnight video-polysomnogram (vPSG), however, even for sleep experts, interpreting vPSG data is challenging. Using a 3D camera, automated analysis of movements has yielded high accuracy. We aimed to replicate and extend prior work using a conventional 2D camera.

Methods: The dataset included 172 vPSG recordings from a clinical sleep center, 81 patients with iRBD and 91 non-RBD healthy controls (63 with a range of other sleep disorders and 28 healthy sleepers). An optical flow computer vision algorithm automatically detected movements during rapid eye movement (REM) sleep, from which features of rate, ratio, magnitude and velocity of movements, and ratio of immobility were extracted.

Results: Patients with iRBD exhibited an increased number of shorter movements and immobility periods. Accuracies for detecting iRBD ranged from 84.9% (with 2 features) to 87.2% (with 5 features). Combining all 5 features but only analyzing short (0.1-2 second duration) movements achieved the highest accuracy at 91.9%. Of the 11 patients with iRBD without noticeable movements during vPSG, 7 were correctly identified.

Interpretation: This work improves prior art by using a 2D camera routinely used in sleep laboratories and improving performance by adding only 3 features. This approach could be implemented in clinical sleep laboratories to facilitate and improve the diagnosis of iRBD. Coupled with automated detection of REM sleep, it should also be tested in the home environment using conventional infrared cameras to detect and/or monitor RBD. ANN NEUROL 2025;97:860-872.

PubMed Disclaimer

Conflict of interest statement

The authors report no competing interests.

Figures

FIGURE 1
FIGURE 1
Overview of our method. Our pipeline starts with trimming the segments featuring REM sleep (vPSG manually scored) from the patient's sleep recording. Next, we used an optical flow algorithm to trim the movement segments based on the motion area and intensity from the RGB video clips. The color represents the direction of the flow vector. Typically, the color wheel is mapped onto the flow field, with different colors representing different directions. Red = horizontal motion to the right, blue = horizontal motion to the left, green = vertical motion upward, and purple = vertical motion downward. Shades of these colors represent intermediate directions. Intensity/brightness: these represent the speed of the flow, with higher intensity indicating faster motion and lower intensity indicating slower motion. This information is then used to extract different features characterizing the patient's movements. Finally, an MLP classifier is trained using feature values to automatically determine if the patient has RBD. The output of the classifier is the probability of each class (0–1). MLP = Multilayer Perceptron; RBD = REM sleep behavior disorder; REM = rapid eye movement; RGB = red, green, blue; vPSG = video‐polysomnogram. [Color figure can be viewed at www.annalsofneurology.org]
FIGURE 2
FIGURE 2
Analysis of Movement and Immobility periods in REM sleep in RBD and control groups. (A) shows a detailed distribution of the shorter movements < 10 seconds compared with longer movements > 10 seconds. (B) shows the distribution of movements with duration ranging 0.1 to 2 seconds (“short”), 2 to 15 seconds (“medium”), 15 to 300 seconds (“long”), and all movements (“extended” approach) regardless of their duration. (C) Shows the distribution of immobility periods according to their duration in minutes. (D) Shows the average durations of periods of immobility among movements with short, medium, or long duration. Note that immobility periods increase in duration as they bound movement periods of increasing duration and that the RBD group displays shorter immobility periods between movements across all movement categories. The extended approach shows immobility periods with an average shorter duration for both groups as it includes immobility periods shorter than 1 second. RBD = REM sleep behavior disorder; REM = rapid eye movement. [Color figure can be viewed at www.annalsofneurology.org]
FIGURE 3
FIGURE 3
Performance (AUC of ROC curves) of classifiers differentiating patients with iRBD from healthy control when various feature characteristics are sequentially included. The shaded regions reflect the 95% confidence intervals for each classifier and movement category. The bracketed values reflect the lower and upper bounds of the 95% confidence interval. Note that the highest AUC (0.959) is found with classifier 3 when considering only movements of short duration (0.1–2 seconds). AUC = area under the receiver operating curve; iRBD = isolated rapid eye movement sleep behavior disorder; ROC = receiver operating characteristic. [Color figure can be viewed at www.annalsofneurology.org]
FIGURE 4
FIGURE 4
Accuracy of each classifier across categories of movements. [Color figure can be viewed at www.annalsofneurology.org]
FIGURE 5
FIGURE 5
Analysis of feature importance and impact on the prediction of classifier 3 using short movements. (A) The correlation matrix display Spearman's correlation coefficients to help understand monotonic relationships between features and the label (label is 1 for RBD and 0 for non‐RBD). The Spearman's correlation coefficient reflects the strength of the monotonic relationships between each pair of features and the label (1 for positive, −1 for negative, and 0 for no correlation). The rate, ratio, and magnitude of movements have the highest Spearman's coefficients with strong, statistically significant correlation with the presence of RBD. Rate and ratio are strongly correlated with each other (1.0). Velocity has a weaker, but still positive relationship, however, ratio‐imm shows a slightly negative, not significant, correlation with the label. There is minimal correlation between most of the features, indicating low multicollinearity, which is preferred for model training. A single asterisk (*) and 3 asterisks (***) indicate that the p < 0.05 and 0.001, respectively. (B) The Gradient Explainer of the SHAP values provides a more nuanced view of feature importance and impact on model predictions, including nonlinear effects. The Gradient Explainer utilizes the gradients of the model's output with respect to its input features. These gradients indicate how small changes in the input features affect the output. A positive SHAP value indicates that the feature contributes positively to pushing the prediction above the baseline, and vice versa. For the movement rate, SHAP values range from −1.0 to 1.0 and points are widely spread across this range, with both high and low feature values (represented by red and blue points, respectively) significantly influencing the model's predictions. For the ratio, the SHAP values range approximately from −0.75 to 0.75, also showing a significant though slightly less pronounced impact on the model's predictions, as indicated by the narrower range of SHAP values. Values for movement magnitude and velocity range approximately from −0.5 to 0.5 with a concentration around zero, indicating that those features have a moderate impact on the model's output, with both high and low values influencing the classification. Finally, for the ratio of immobility periods (ratio‐imm), the SHAP values (−0.3 to 0.3) show the narrowest spread with most points clustered around zero. See Supplementary Table S3 for SDs. Ratio‐imm = ratio of immobility; RBD = rapid eye movement sleep behavior disorder; SD = standard deviation; SHAP = SHapley Additive exPlanations; Vel = velocity. [Color figure can be viewed at www.annalsofneurology.org]

References

    1. Haba‐Rubio J, Frauscher B, Marques‐Vidal P, et al. Prevalence and determinants of rapid eye movement sleep behavior disorder in the general population. Sleep 2018;41:zsx197. - PubMed
    1. Lee WJ, Baek SH, Im HJ, et al. REM sleep behavior disorder and its possible Prodromes in general population: prevalence, polysomnography findings, and associated factors. Neurology 2023;101:e2364–e2375. - PMC - PubMed
    1. Stefani A, Serradell M, Holzknecht E, et al. Low specificity of rapid eye movement sleep behavior disorder questionnaires: need for better screening methods. Mov Disord 2023;38:1000–1007. - PubMed
    1. Cesari M, Heidbreder A, St. Louis EK, et al. Video‐polysomnography procedures for diagnosis of rapid eye movement sleep behavior disorder (RBD) and the identification of its prodromal stages: guidelines from the international RBD study group. Sleep 2022;45:zsab257. - PubMed
    1. Bliwise DL, Fairley J, Hoff S, et al. Inter‐rater agreement for visual discrimination of phasic and tonic electromyographic activity in sleep. Sleep 2018;41:zsy080. - PubMed

LinkOut - more resources