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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ai_posture_monitor-0.0.22.tar.gz.
File metadata
- Download URL: ai_posture_monitor-0.0.22.tar.gz
- Upload date:
- Size: 35.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5188a192d6ea624bfdf0ca4949ac72c84bbcec230b87ebcc3c63d5a7ef05879
|
|
| MD5 |
fcb9f22e7084fa423c89e50f770609f4
|
|
| BLAKE2b-256 |
8ba22186d89f93298c8f3581fe738371a6f5c43443716409970f2e00d27744ba
|
File details
Details for the file ai_posture_monitor-0.0.22-py3-none-any.whl.
File metadata
- Download URL: ai_posture_monitor-0.0.22-py3-none-any.whl
- Upload date:
- Size: 35.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
67425429b52e67fb8fbf1dd70495c94c4b6ea77fe93bb013e0039cf803a7f55c
|
|
| MD5 |
c90b319c96a2500d303e585555f9bd28
|
|
| BLAKE2b-256 |
d38e3b418300f9164203546962fd4a03b0ad1fcf0111e650ac0d670f89e679bd
|