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
. 2023 Oct 3;2(10):e0000353.
doi: 10.1371/journal.pdig.0000353. eCollection 2023 Oct.

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

Affiliations

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

Allan J Kember et al. PLOS Digit Health. .

Abstract

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.

PubMed Disclaimer

Conflict of interest statement

I have read the journal’s policy and the authors of this manuscript have the following competing interests: AJK is the volunteer (unpaid) Chief Executive Officer and President of one of the study funders, Shiphrah Biomedical Inc. (SBI). AJK did not receive financial or material payment for his involvement in this study. EP is a volunteer at SBI and a shareholder in SBI. EP received a financial payment for her involvement in this study from the study funds. HH was involved in this work via an internship as part of his graduate studies at the University of Toronto. HH received a financial payment for his internship from the study funds. HH has no role in ownership, management, or control of SBI. RS, HZ, FR, SA, BT, SRH, and ED have no competing interests that could be perceived to bias this work.

Figures

Fig 1
Fig 1. Twelve simulated positions. Example of each of the twelve simulated positions, P1 through P12, without a bed covering the participant’s body.
Fig 2
Fig 2. Schematic representation of dataset development and annotation and model development and evaluation.
Frames were extracted from video recordings via FFMPEG and manually reviewed to classify them into the twelve positions without bed sheets and with bed sheets covering the body. Low-quality frames and frames without a participant (negatives) were set aside. The manually sorted frames were then semi-randomly down-sampled and localization and annotations were then completed with LabelImg. The negative frames were augmented using the ImageDataGenerator class in the Keras library and were then combined with the annotated frames in the training and validation phase, which was by six-fold cross-validation on a virtual GPU (NVIDIA Tesla P100 on Google Colab) using YOLOv5s by Ultralytics and pre-trained weights from the COCO dataset. The weights of the model in each loop of the cross-validation that achieved the best mAP on the validation set were saved as the best weights. Performance evaluation for each loop was completed on the testing set using the best weights, and the performance was evaluated by computing the mAP, precision, and recall. Various classes with similar anatomic and hemodynamic implications on uteroplacental perfusion were subsequently combined, which resulted in a simpler, collapsed-resolution (CR) condition (see the supplementary file S2 Appendix).
Fig 3
Fig 3. Grouped bar charts of performance parameters from the testing phase (precision, recall, mAP@0.50, and mAP@.50-.95) averaged across the six models’ testing sets and across all classes, where the parameters are presented under three conditions.
(1) Red bar: averaged across all classes as a combination of the “with bed sheets” and “without bed sheets” conditions (24 classes). (2) Blue bar: averaged across all classes under the “without bed sheets” condition (12 classes). (3) Yellow bar: averaged across all classes under the “with bed sheets” condition (12 classes). The error bars represent one standard deviation of the respective value across all measures, which reflects the variability both across models and classes.
Fig 4
Fig 4. 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 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 color 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 12 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 the “all class average” rows, the value in the AP@0.50 column is the mAP@0.50, and the value in the AP@.50-.95 column is the mAP@.50-.95 since these values represent averages across multiple classes.
Fig 5
Fig 5. Example output of one of our trained models to localize and classify the sleeping position of a study participant.
Ground truth localizations and labels are on the left. Model predictions of localizations and labels are on the right.

Similar articles

References

    1. Romero R, Badr MS. A Role for Sleep Disorders in Pregnancy Complications: Challenges and Opportunities. Am J Obstet Gynecol. 2014;210: 3–11. doi: 10.1016/j.ajog.2013.11.020 - DOI - PMC - PubMed
    1. Ding X-X, Wu Y-L, Xu S-J, Zhang S-F, Jia X-M, Zhu R-P, et al.. A systematic review and quantitative assessment of sleep-disordered breathing during pregnancy and perinatal outcomes. Sleep Breath Schlaf Atm. 2014;18: 703–713. doi: 10.1007/s11325-014-0946-4 - DOI - PubMed
    1. Li L, Zhao K, Hua J, Li S. Association between Sleep-Disordered Breathing during Pregnancy and Maternal and Fetal Outcomes: An Updated Systematic Review and Meta-Analysis. Front Neurol. 2018;9: 91. doi: 10.3389/fneur.2018.00091 - DOI - PMC - PubMed
    1. Warland J, Dorrian J, Morrison JL, O’Brien LM. Maternal sleep during pregnancy and poor fetal outcomes: A scoping review of the literature with meta-analysis. Sleep Med Rev. 2018;41: 197–219. doi: 10.1016/j.smrv.2018.03.004 - DOI - PubMed
    1. Pamidi S, Pinto LM, Marc I, Benedetti A, Schwartzman K, Kimoff RJ. Maternal sleep-disordered breathing and adverse pregnancy outcomes: a systematic review and metaanalysis. Am J Obstet Gynecol. 2014;210: 52.e1-52.e14. doi: 10.1016/j.ajog.2013.07.033 - DOI - PubMed

Grants and funding

This study was funded by a Mitacs Accelerate Program grant (No. IT 26263). Mitacs Accelerate (Ottawa, Canada), which connects companies with over 50 research-based universities through graduate students and postdoctoral fellows, who apply their specialized expertise to business challenges. Interns transfer their skills from theory to real-world application, while the companies gain a competitive advantage by accessing high-quality research expertise. In this study, the intern was HH. The university was the University of Toronto. The professor was ED. The company was Shiphrah Biomedical Inc. (Toronto, Canada). The total study funding was $15,000 CAD and was provided through Mitacs to the University of Toronto for ED to administer for the intern (HH) and the study expenses. For the grant (No. IT 26263), Mitacs provided 50% of the study funding and had no other role in the study. Mitacs contribution to the grant (No. IT 26263) was matched by SBI, which provided the remaining 50%. SBI also provided an internship experience for HH. HH was co-supervised by ED (University of Toronto) and AJK (SBI). Mitacs had no role in study design, data collection and analysis, decision to publish, or preparation of the manuscript, whereas SBI had a role in all these aspects via AJK. Mitacs Accelerate website: https://www.mitacs.ca/en/programs/accelerate Shiphrah Biomedical Inc. website: https://shiphrahbiomedical.com.

LinkOut - more resources