DOI: 10.5281/zenodo.16419484
title: # data.py  import os import numpy as np import torch from torch.utils.data import Dataset, DataLoader from torchvision import transforms from PIL import Image   class InductionDataset(Dataset):     """     Dataset for multimodal labor induction prediction:     - Structured clinical features     - Time-series (e.g., uterine activity)     - Imaging data (e.g., ultrasound frames)     """     def __init__(self, data_dir, split='train', transform=None):         super().__init__()         self.data_dir = data_dir         self.split = split         self.transform = transform          # Load metadata         self.meta = self._load_metadata()      def _load_metadata(self):         # Simulated metadata structure; replace with real index logic         meta_path = os.path.join(self.data_dir, f'{self.split}_meta.npy')         if not os.path.exists(meta_path):             raise FileNotFoundError(f"Metadata file not found: {meta_path}")         return np.load(meta_path, allow_pickle=True)      def __len__(self):         return len(self.meta)      def __getitem__(self, idx):         record = self.meta[idx]          # Load structured features (e.g., age, parity, Bishop score)         structured = torch.tensor(record['clinical'], dtype=torch.float32)          # Load time-series signal (e.g., uterine activity)         ts_path = os.path.join(self.data_dir, record['ts_path'])         timeseries = torch.tensor(np.load(ts_path), dtype=torch.float32)          # Load image (e.g., ultrasound)         img_path = os.path.join(self.data_dir, record['image_path'])         image = Image.open(img_path).convert('L')  # grayscale         if self.transform:             image = self.transform(image)         else:             image = transforms.ToTensor()(image)          # Load label (e.g., [τ_active, τ_delivery, delivery_mode, Apgar scores])         label = torch.tensor(record['label'], dtype=torch.float32)          return {             'structured': structured,             'timeseries': timeseries,             'image': image,             'label': label         }   def get_dataloader(data_dir, batch_size=32, split='train', shuffle=True):     transform = transforms.Compose([         transforms.Resize((128, 128)),         transforms.ToTensor()     ])     dataset = InductionDataset(data_dir, split=split, transform=transform)     return DataLoader(dataset, batch_size=batch_size, shuffle=shuffle, num_workers=4)

description: # CERVINet-DELTA: Multimodal Time-Series Framework for Labor Induction Prediction

> A robust deep learning framework for individualized prediction of labor outcomes induced by dinoprostone, using multimodal fusion and temporal attention modeling.

## 🧠 Overview

**CERVINet-DELTA** is an interpretable and personalized predictive system that models the dynamic process of labor induction. It fuses structured clinical features, ultrasound imagery, and time-series uterine activity using attention-enhanced neural networks to forecast key outcomes such as:

- Time to active labor- Total time to delivery- Delivery mode (vaginal, assisted, cesarean)- Neonatal Apgar scores

This framework supports **real-time decision making**, **risk stratification**, and **policy optimization** based on individualized clinical profiles.

## 📦 Features

- ⚙️ **CERVINet**: Stochastic latent dynamics with encoder-decoder architecture and temporal GRU transitions.- 🧮 **DELTA**: Policy reasoning and utility-driven intervention module for dinoprostone titration.- 🧊 Multimodal data support: Time-series, tabular, and image modalities.- 📈 Evaluation across multiple labor datasets (Dinoprostone, Multimodal Labor, Attention-Weighted).- 🧪 Ablation studies on core modules.

## 📁 Folder Structure