Methods
Design
This study leverages real-world, overnight, video recordings collected
from an ongoing, prospective, observational, four-night, home sleep
apnea study (ClinicalTrials.gov Identifier: NCT05376475) and
controlled-setting video recordings from a cross-sectional study, which
is open-access and can be found
online.5A core outcome set was not used in the design of this study.
Participants
Participants were recruited Canada-wide by the research team via various
social media platforms. All data collection was completed within the
participants’ own homes.
Participants for the real-world study were eligible to take part if
their American Society of Anesthesiologists Physical Status (ASA PS)
class was II or lower, they had a low-risk singleton pregnancy, were in
the third trimester (between 28 weeks and 0 days through 40 weeks and 6
days gestation, inclusive, determined by first-trimester ultrasound),
were aged 18 to 50 years, had a 2.4 GHz Wi-Fi network in their home, and
slept in a bed at night (i.e., not a reclining chair or similar).
Participants’ bed partners were eligible to participate if their ASA PS
class was II or lower and they slept in the same bed as the pregnant
participant. Exclusion criteria for both the participant and their bed
partner included non-English speaking, reading, or writing and ASA PS
class III or higher.
For the participant eligibility criteria of the controlled-setting
study, please refer to the
publication.5
Interventions
Eligible participants and their bed partners provided voluntary,
written, informed consent to participate. Basic demographic data was
collected from each participant and their participating bed partner.
Each participant used a home-surveillance camera to record a video of
themselves and their bed partner sleeping overnight for a total of four
nights. See Appendix A for additional details regarding
interventions in the real-world study.
For the interventions in the controlled-setting study, see the
publication.5
Outcomes
The main outcomes for this study were the precision and recall of the
model for detecting thirteen pre-defined body positions (seeDataset Development , below). The outcome of the real-world
study pertaining to the present study was the sleeping position of the
pregnant participant and bed partner. See Appendix A for
additional details. For the outcomes in the controlled-setting study,
see the
publication.5
Sample Size
For the real-world study, we selected a target sample size of N=60
couples (see Appendix A ). Recruitment for the real-world study
is ongoing, and the present study uses a subset of this data. In the
controlled-setting study, the target sample size was
twenty.5
Statistical Methods
We assessed the normality of continuous variables via the Shapiro-Wilk
test at a 0.05 significance level and indicated deviations from
normality in our results. Statistical analyses were conducted using the
R Statistical Software package (Version
4.2.2).6
Dataset Development
All video recordings were reviewed manually by two trained reviewers and
frames (images) were extracted at specific time points. The reviewers
manually and independently annotated the extracted frames using an
open-source annotation tool, LabelImg (see Appendix
A ).7Following our previous
work,5body positions were classified into twelve position classes, including:
left recovery, left lateral, left tilt, supine, supine thorax with left
pelvic tilt, supine thorax with right pelvic tilt, supine pelvis with
left thorax tilt, supine pelvis with right thorax tilt, right tilt,
right lateral, right recovery, and sitting up at the edge of the bed
(see Figure A.1 in Appendix A ). In addition, we added
a prone position class for a total of thirteen body position classes.
Since pillows can impact sleeping positions, our model (SLeeP AIDePt-2)
was designed to detect pillows. This involved identifying pillows –
such as head pillows, body pillows, pregnancy pillows, and wedge pillows
– in various locations on the bed. As a result, we thoroughly reviewed
the controlled-setting dataset and annotated the presence of pillows in
those frames as well (see Appendix A ).
Model Development and
Evaluation
We framed the detection of sleeping positions and pillows as a
multi-participant, multi-class, classification problem where
state-of-the-art deep Convolutional Neural Networks were used. In this
regard, we used YOLOv5s (You Only Look Once, version 5s) with 7.5
million
parameters,8,9including pre-trained weights from the COCO (Common Objects in Context)
dataset and fine-tuned it on our annotated dataset to make predictions
of classes. The experiment was implemented using the PyTorch framework.
The model was trained using stochastic gradient descent with momentum,
an initial learning rate of 0.01, a batch size of 32, and early stopping
criteria.10,11The training was conducted under the Linux virtual machine running on
Google Colab with an NVIDIA A100 (SXM4) 40GB GPU.
Our dataset was split into five non-overlapping folds, and we then
trained, validated, and tested SLeeP AIDePt-2 by five-fold cross
validation. In each loop of the cross-validation, three folds served as
the training set, one fold was the validation set, and one fold was the
testing set. Five loops were completed so each fold was given a turn to
be the validation set and testing set. The weights that achieved the
highest mean average precision (mAP) on the validation set were saved
for each loop. Finally, performance evaluation was completed using the
best weights on the testing set for each loop, and the following
standard performance measures were calculated for each class: precision
(analogous to “positive predictive value” in the clinical realm),
recall (analogous to “sensitivity”), and average precision (AP), which
is the area under the precision-recall curve (similar to how AUROC is
the area under the receiver-operator curve), at standard intersection
over union (IoU) values.
See Appendix A for more details regarding our rationale for
using YOLOv5s and disabling flip augmentation; use of k-fold cross
validation, early stopping criteria, a weighted random sampler; and
definitions of standard performance measures, allocation of the study
participants to the five folds, and the training, validation, and
testing set assignments for each loop.
Patient and Public
Involvement
Patients and public were not involved in the design of this study;
however, this rationale for this study was informed by the experiences
of pregnancy loss parents, who have brought maternal sleeping position
to the attention of researchers and clinicians
internationally.12