How shrutii07/cap-phase-detection works
Project Type and Purpose
• This is a machine‐learning research pipeline (not a traditional web app). It ingests single‐channel EEG recordings (EDF + annotation TXT), automatically preprocesses them, prepares a balanced dataset, then trains and evaluates a 1-D CNN to classify CAP sleep phases A/B for healthy and disordered subjects.
Key Components (to include
a. Data Sources
• PhysioNet CAP Sleep Database (EDF + annotation TXT files)
• Optional: Kaggle dataset (already balanced)
b. Data Preprocessing
• MATLAB/Octave scripts:
• Data_preparation_from_annotations.m
• edfread.m
• Output: raw segmented EEG signals with labels
c. Cloud/Object Storage
• Google Drive (or any cloud storage) to persist preprocessed files
d. Dataset Preparation Notebook
• Dataset_preparation_CAP_phases.ipynb running in Colab
• Reads preprocessed data, balances classes, serializes into training/test sets (e.g., NumPy arrays or TFRecords)
e. Model Training & Evaluation Notebook
• CAP_phase_detection.ipynb running in Colab
• Loads prepared dataset, defines/compiles 1-D CNN (TensorFlow/Keras or PyTorch), trains model, logs metrics, saves trained weights and history files
f. Outputs/Artifacts
• Trained model files (.h5, .pt)
• Training history and evaluation reports
• Figures (accuracy/loss plots, confusion matrices)
Architectural Patterns & Design Principles
• Pipeline/ETL Pattern: clear separation of extraction (EDF read), transformation (preprocessing & balancing), and loading (dataset serialization).
• Modular Notebooks: each notebook handles one stage (data prep vs. model training).
• Stateless Compute: using Colab for ephemeral compute—state is kept in cloud storage.
• Reproducibility: all steps are scripted (MATLAB + Jupyter) and stored in version control.
Technologies & Frameworks to annotate
• MATLAB or GNU Octave (for .m scripts)
• Python 3.x, Jupyter/Colab
• NumPy, Pandas (data manipulation)
• TensorFlow/Keras or PyTorch (CNN model)
• Google Drive API (for data storage)
• PhysioNet, Kaggle (external data sources)
Diagramming Conventions
• Components: rectangles with clear labels (e.g., “EDF Reader (edfread.m)”).
• External services: clouds or parallelograms (e.g., “PhysioNet CAP DB”).
• Blue for compute/process modules
• Green for data storage
• Orange for external systems