Vision-based detection and quantification of maternal sleeping position in the third trimester of pregnancy in the home setting–Building the dataset and model

In 2021, the National Guideline Alliance for the Royal College of Obstetricians and Gynaecologists reviewed the body of evidence, including two meta-analyses, implicating supine sleeping position as a risk factor for growth restriction and stillbirth. While they concluded that pregnant people should be advised to avoid going to sleep on their back after 28 weeks’ gestation, their main critique of the evidence was that, to date, all studies were retrospective and sleeping position was not objectively measured. As such, the Alliance noted that it would not be possible to prospectively study the associations between sleeping position and adverse pregnancy outcomes. Our aim was to demonstrate the feasibility of building a vision-based model for automated and accurate detection and quantification of sleeping position throughout the third trimester–a model with the eventual goal to be developed further and used by researchers as a tool to enable them to either confirm or disprove the aforementioned associations. We completed a Canada-wide, cross-sectional study in 24 participants in the third trimester. Infrared videos of eleven simulated sleeping positions unique to pregnancy and a sitting position both with and without bed sheets covering the body were prospectively collected. We extracted 152,618 images from 48 videos, semi-randomly down-sampled and annotated 5,970 of them, and fed them into a deep learning algorithm, which trained and validated six models via six-fold cross-validation. The performance of the models was evaluated using an unseen testing set. The models detected the twelve positions, with and without bed sheets covering the body, achieving an average precision of 0.72 and 0.83, respectively, and an average recall (“sensitivity”) of 0.67 and 0.76, respectively. For the supine class with and without bed sheets covering the body, the models achieved an average precision of 0.61 and 0.75, respectively, and an average recall of 0.74 and 0.81, respectively.


Methods
We present the performance evaluation of the models from each loop under a collapsed resolution (CR) condition where we reduced the total number of classes by combining classes with similar anatomic and hemodynamic implications from the perspective of uteroplacental perfusion.In the CR models, we combined left recovery (P1), left lateral (P2), left tilt (P3), and supine thorax with left pelvic tilt (P7) into one class, "CR Left".We combined supine (P4), supine pelvis with left thorax tilt (P5), and supine pelvis with right thorax tilt (P6) into one class, "CR Supine", which requires a supine pelvis.We combined supine thorax with right pelvic tilt (P8) and right tilt (P9) into one class, "CR Right tilt", because some studies have shown that right pelvic tilt may worsen IVC compression or fail to relieve it and result in reduced maternal cardiac output and stroke volume in comparison to the effect of left pelvic tilt.[1][2][3][4][5][6][7] Finally, we combined right lateral (P10) and right recovery (P11) into one class, "CR Right".Sitting up at the edge of the bed (P12) remained as its own class, "CR Sitting".

Results
S1 Fig shows a heatmap of precision, recall, AP@0.50, and AP@.50-.95 (columns) from the testing phase averaged across the six models' test sets for each of the predicted collapsedresolution (CR) classes (rows) under the "without bed sheets" and "with bed sheets" condition.
The value of the respective performance parameter is mapped to a colour spectrum from red to yellow to green where values of 0.50 or less are represented by red at the lower end of the spectrum, values around 0.75 are shades around yellow (oranger if lower than 0.75; greener if higher than 0.75), and values of 0.90 or more are represented by green at the higher end of the spectrum.The "all class average" is provided as the averaged value of the respective performance parameter across the six models' test sets and the five CR classes under each bed sheets condition, and the "combined 24 class average" is given as the average of the former two values combined.For these "all class average" rows, the value in the AP@0.50 column is a mAP@0.50, and the value in the AP@.50-.95 column is a mAP@.50-.95since these values represent averages across multiple classes.
On a per class basis under the "without bed sheets" condition, the AP@0.50 across the models was highest for the right CR class, followed by supine CR, left CR, and sitting, with the right tilt class having the lowest AP@0.50 across the models.When the "with bed sheets" condition is considered, the AP@0.50 across the models was highest for the sitting class, followed by left CR, right CR, and supine CR, with the right tilt class, as seen in the "without bed sheets" condition, having the lowest AP@0.50 across the models.

S1 Fig. Heatmap of precision, recall
, AP@0.50, and AP@.50-.95 (columns) from the testing phase averaged across the six models for each of the predicted collapsedresolution (CR) classes (rows) under the "without bed sheets" (upper blue row header) and "with bed sheets" condition (lower yellow row header).The value of the respective performance parameter is mapped to a colour spectrum from red to yellow to green where values of 0.50 or less are represented by red at the lower end of the spectrum, values around 0.75 are shades around yellow (oranger if lower than 0.75; greener if higher than 0.75), and values of 0.90 or more are represented by green at the higher end of the spectrum.The "all class average" is provided as the averaged value of the respective performance parameter across the six models' test sets and the five collapsed-resolution classes under each bed sheets condition, and the combined "24 class average" is given (red column) as the average of the former two values combined.For these "all class average" rows, the value in the AP@0.50 column is a mAP@0.50, and the value in the AP@.50-.95 column is a mAP@.50-.95since these values represent averages across multiple classes.