Skip to main content

A package designed to predict static pose and detect falls with 2D RGB Camera in well lit indoor environments.

Project description

AI Posture Monitor

This project introduces an innovative, cost-effective solution for real-time activity monitoring of elderly individuals. By leveraging the MediaPipe pose estimation model, fuzzy logic, and finite state machines, the system can reliably track individuals, recognize static postures (standing, sitting, lying), and detect transitions, particularly focusing on falls.

Source code: https://github.com/pat2echo/AI-Posture-Monitor Dataset (CC BY 4.0): https://www.kaggle.com/datasets/patrickogbuitepu/posture-monitor-and-fall-detection Demo notebook on Kaggle: https://www.kaggle.com/code/patrickogbuitepu/fall-detection-posture-classification-starter

Requirements

Python 3.9 - 3.12 (mediapipe, the pose-estimation dependency, ships no wheels for 3.13+ in the supported version range).

Supported environments: local CLI/Jupyter and Kaggle notebooks. Google Colab is not officially supported (its runtime preloads libraries that conflict with mediapipe's pinned dependencies).

Quickstart

Set up a virtual environment and install:

# Linux / macOS / WSL (use python3.12/3.11/3.10 if your default python3 is 3.13+):
python3.12 -m venv .venv && source .venv/bin/activate
pip install ai-posture-monitor kagglehub
# Windows:
py -3.12 -m venv .venv && .venv\Scripts\activate
pip install ai-posture-monitor kagglehub

Classify a static pose in a few lines (fetches a sample image from the public Kaggle dataset - no Kaggle account needed):

import kagglehub
import ai_posture_monitor as pm

img = kagglehub.dataset_download(
    'patrickogbuitepu/posture-monitor-and-fall-detection', path='train/pose/stand.jpg')

pose, mp_drawing, mp_pose = pm.initialize_mediapipe()
results, img_rgb, landmarks = pm.detect_pose_landmarks(img, pose=pose, show=True)
print(pm.get_features(landmarks[['X', 'Y', 'Z']].to_numpy(), image_name='stand.jpg'))
# -> ['stand.jpg', True, 59, 'standing', 'standing', 82, 86, 'non_sitting', ...]

CLI demo

A ready-made command-line demo (prints a stand/sit/lie verdict table and saves landmark-annotated images) lives in the repository:

git clone https://github.com/pat2echo/AI-Posture-Monitor
python AI-Posture-Monitor/examples/cli_demo.py                  # 3 sample images from the dataset
python AI-Posture-Monitor/examples/cli_demo.py --images my.jpg  # your own photos

Try it on Kaggle (zero setup)

Open the demo notebook and click "Copy & Edit": https://www.kaggle.com/code/patrickogbuitepu/fall-detection-posture-classification-starter

Fall detection on video

import ai_posture_monitor as pm

pe = pm.PoseEstimation()
pe.process_video(video_file='my_video.mp4', plot_results=True)                      # fall detection
pe.process_video(video_file='my_video.mp4', plot_results=True, predict_fall=False)  # posture only

Features

  • Real-Time Activity Monitoring: Tracks and analyzes movements continuously.
  • Pose Detection: Identifies key postures: standing, sitting, and lying down.
  • Fall Detection: Detects falls with minimal false alarms.
  • Fuzzy Logic Analysis: Utilizes fuzzy logic for accurate movement interpretation.
  • User-Centric Design: Tailored for elderly individuals living alone.
  • Environmental Adaptability: Functions effectively in well-lit indoor settings.
  • Scalable and Cost-Effective: Affordable solution for diverse applications.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ai_posture_monitor-0.0.21.tar.gz (35.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ai_posture_monitor-0.0.21-py3-none-any.whl (35.6 kB view details)

Uploaded Python 3

File details

Details for the file ai_posture_monitor-0.0.21.tar.gz.

File metadata

  • Download URL: ai_posture_monitor-0.0.21.tar.gz
  • Upload date:
  • Size: 35.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for ai_posture_monitor-0.0.21.tar.gz
Algorithm Hash digest
SHA256 eccb0fc293ea96d5f80a70ab65e66ddf1c7cbe1703326a760d249cd977b7e94d
MD5 1590bfedc1ebe94765e16315c3f36387
BLAKE2b-256 1469c3c249586bcf22df5df16e97799bbc49664ea928b0b7e95ed06908c00311

See more details on using hashes here.

File details

Details for the file ai_posture_monitor-0.0.21-py3-none-any.whl.

File metadata

File hashes

Hashes for ai_posture_monitor-0.0.21-py3-none-any.whl
Algorithm Hash digest
SHA256 fb30825a9c8bdab8c7599eb4e51fbb6d98709c9d564d04a352c4094947a6746d
MD5 f3792c758dbeefeb6699d50dd0dec90b
BLAKE2b-256 ffe20607797e79f5c13fde4e58619f40e375d1be0b69ea22373aa3bc82aa57a1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page