Skip to content

MohammedAmine0012/cmi-detect-behavior-with-sensor-data

Repository files navigation

BFRB Detection using Sensor Data

This project focuses on detecting Body-Focused Repetitive Behaviors (BFRB) using sensor data, including IMU, thermal, and time-of-flight sensors. The goal is to classify different types of BFRB gestures to aid in behavioral therapy and monitoring.

Project Structure

cmi-detect-behavior-with-sensor-data/
├── data_preparation_full/      # Full sensor data processing
├── data_preparation_imu_only/  # IMU-only data processing
├── kaggle_evaluation/          # Kaggle competition evaluation code
├── analyze_features.py         # Feature analysis scripts
├── baseline_model.py           # Baseline model implementation
├── bfrb_models.py             # Advanced BFRB detection models
├── data_preparation_steps.py   # Data preprocessing pipeline
├── enhanced_feature_engineering.py  # Advanced feature engineering
├── explore_data.py            # Data exploration scripts
├── feature_engineering.py      # Basic feature engineering
├── requirements.txt            # Python dependencies
├── run_bfrb_pipeline.py        # Main pipeline execution
├── sequence_models.py          # Sequence-based models (LSTM, etc.)
└── train_sequence_models.py    # Training scripts for sequence models

Features

  • Multi-sensor data processing: Handles IMU, thermal, and time-of-flight sensor data
  • Advanced feature engineering: Time-domain, frequency-domain, and statistical features
  • Multiple model architectures:
    • Traditional ML models (XGBoost, LightGBM)
    • Deep learning models (LSTM, CNN, etc.)
    • Ensemble methods
  • Kaggle competition ready: Includes evaluation framework

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/cmi-detect-behavior-with-sensor-data.git
    cd cmi-detect-behavior-with-sensor-data
  2. Create and activate a virtual environment (recommended):

    python -m venv venv
    source venv/bin/activate  # On Windows: .\venv\Scripts\activate
  3. Install dependencies:

    pip install -r requirements.txt

Usage

  1. Data Preparation:

    python data_preparation_steps.py
  2. Feature Engineering:

    python enhanced_feature_engineering.py
  3. Train Models:

    • For traditional ML models:
      python run_bfrb_pipeline.py
    • For sequence models:
      python train_sequence_models.py
  4. Evaluate Models:

    • Run the Kaggle evaluation framework:
      python kaggle_evaluation/cmi_inference_server.py

Data

The dataset includes:

  • Sensor Data:
    • IMU (acc_x, acc_y, acc_z, rot_w, rot_x, rot_y, rot_z)
    • Thermal sensors (thm_1 to thm_5)
    • Time-of-Flight sensors (tof_1 to tof_3)
  • Demographics: Age, sex, handedness, height, arm measurements
  • Labels: 8 target BFRB gestures and 10 non-target behaviors

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

About

This project focuses on detecting Body-Focused Repetitive Behaviors (BFRB) using sensor data,

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages