Skip to content

This project implements a multi-class classifier to detect sleep positions (Left, Supine, Right) using both classical machine learning and deep learning techniques. It incorporates advanced preprocessing with neutrosophic image transformation followed by feature extraction and classification using SVM, KNN, and CNN models.

License

Notifications You must be signed in to change notification settings

karthiksuki/Sleep-Position-Classification

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sleep Position Classifier

A machine learning-based Sleep Position Classifier designed to identify one of three sleep postures: Left, Supine, and Right. The system leverages classical machine learning (SVM, KNN) and deep learning (CNN) models, using both handcrafted HOG features and raw image inputs. Additionally, a novel Neutrosophic conversion step is applied for enhanced preprocessing using Falsity, Indeterminacy, and Truth maps.


Project Overview

This project aims to classify sleep positions based on image data. The complete pipeline includes image preprocessing using Neutrosophy, feature extraction using HOG (Histogram of Oriented Gradients), and classification using:

  • Support Vector Machine (SVM)
  • K-Nearest Neighbors (KNN)
  • Convolutional Neural Network (CNN)

📁 Dataset

  • Images of individuals in three sleep positions: Left, Supine, and Right
  • Stored in structured class-wise directories
  • Images are initially processed for Neutrosophic mapping to reduce uncertainty

🧠 Preprocessing

Neutrosophic Image Conversion

All input images undergo transformation using the Neutrosophic theory, resulting in three grayscale components:

  • Falsity
  • Indeterminacy
  • Truth

These components are used in downstream model training and evaluation.

HOG Feature Extraction

  • Images are transformed into HOG features with 1764 feature dimensions
  • Used as input for traditional ML models like SVM and KNN

⚙️ Models and Methods

Model Input Type Description Accuracy
SVM HOG Features (1764D) Linear classification on handcrafted features 96%
KNN HOG Features (1764D) K=7 neighbors for classification 95.67%
CNN Raw Images End-to-end deep learning with ConvNet architecture 96%

🛠️ Tech Stack

  • Python 3.10+
  • OpenCV - Image processing
  • scikit-image - HOG feature extraction
  • scikit-learn - SVM, KNN models
  • TensorFlow / Keras - CNN model building
  • NumPy, Matplotlib - Data handling and visualization
  • Custom Neutrosophic Module - Preprocessing logic
  • HOG - Algorithm

🚀 Getting Started

  1. Clone the repository

    git clone https://github.com/karthiksuki/Sleep-Position-Classification
    cd sleep-position-classifier
  2. Install dependencies

    pip install -r requirements.txt
  3. Run Neutrosophic Preprocessing

    python neutroscophy_conversion/neutroscopic_conversion.py
  4. Train Models

    python models/model_svm.py
    python models/model_knn.py
    python models/model_cnn.py
  5. Make Predictions

    python Prediction_Model.py

📊 Results

  • SVM: 96% Accuracy
  • KNN: 95.7% Accuracy
  • CNN: 96% Accuracy

🧪 Future Improvements

  • Integration with real-time video-based prediction
  • Expand dataset with various body types and sleepwear
  • Include edge-case postures (e.g., fetal, prone)

👨‍💻 Author

  • Dr. Nagarajan Deivanayagampillai, Post-Doctorate, Ph.D
  • Karthikeyan Ganesh - Linkedln

About

This project implements a multi-class classifier to detect sleep positions (Left, Supine, Right) using both classical machine learning and deep learning techniques. It incorporates advanced preprocessing with neutrosophic image transformation followed by feature extraction and classification using SVM, KNN, and CNN models.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages