<<<<<<< HEAD
A complete end-to-end machine learning and deep learning project for detecting fetal movement using accelerometer data from pregnant women.
This project uses accelerometer signals recorded from the abdominal wall of pregnant women to detect fetal movements. The dataset contains recordings from 16 different pregnant women with 3-axis acceleration data sampled at 500Hz.
islamabad/
├── data/
│ ├── *_signal.mat # 3-axis accelerometer data (X, Y, Z)
│ ├── *_bp.mat # Maternal perception markers (labels)
│ └── readme.txt # Dataset description
├── Fetal_Movement_Detection.ipynb # Main analysis notebook
└── README.md # This file
- Source: Accelerometer recordings from pregnant women
- Subjects: 16 pregnant women
- Sensor: ADXL355 accelerometer (ANALOG DEVICES)
- Sampling Frequency: 500 Hz
- Data Format: MATLAB .mat files
*_signal.mat: 3-axis acceleration data*_bp.mat: Maternal perception markers (movement annotations)
The notebook includes an installation cell, but here are the main dependencies:
numpy
pandas
scipy
matplotlib
seaborn
scikit-learn
imbalanced-learn
tensorflow
keras
- Open the
Fetal_Movement_Detection.ipynbnotebook in VS Code or Jupyter - Run the first cell to install all required libraries
- Execute cells sequentially from top to bottom
- Each cell produces immediate output (graphs, metrics, etc.)
- All required packages installation
- Import statements for data science and ML libraries
- Load .mat files from data folder
- Display data structure and first rows
- Check and handle missing values
- Visualize class distribution
- Apply SMOTE if dataset is imbalanced
- Dataset overview and statistics
- Signal visualization (time-series plots)
- Distribution analysis (histograms)
- Correlation heatmap
- Box plots for outlier detection
- Skewness and kurtosis analysis
- Movement labels overlay on signals
- StandardScaler normalization
- Sliding window segmentation (1-second windows, 50% overlap)
- Train/test split (80/20)
- Train Random Forest classifier
- Confusion matrix visualization
- Classification report
- Metrics bar chart (Accuracy, Precision, Recall, F1)
- Feature importance plot
- Build Bidirectional LSTM architecture
- Training with early stopping
- Training vs Validation accuracy plot
- Training vs Validation loss plot
- Confusion matrix
- Classification report
- Metrics bar chart
- ROC curve with AUC score
- Precision-Recall curve
- Side-by-side comparison of Random Forest vs BiLSTM
- Comparative metrics visualization
- 100 estimators
- Max depth: 20
- Features: Flattened window samples
Input Layer (500 timesteps, 3 features)
↓
Bidirectional LSTM (64 units, return sequences)
↓
Dropout (0.3)
↓
Bidirectional LSTM (32 units)
↓
Dropout (0.3)
↓
Dense (32 units, ReLU)
↓
Dropout (0.2)
↓
Dense (1 unit, Sigmoid)
- All code is contained in a single Jupyter notebook
- Each analysis step is in a separate cell for easy execution
- Graphs and outputs are displayed inline
- The notebook is designed to run cell-by-cell in VS Code
Fetal Movement Detection Project
Fetel movement using BiLSTM and also use Random forest model with 98% accuracy
c1b749f519489686678cf7d0779f03dd2515fa8f