Skip to content

kalash33/Edgefit-Coach

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Edgefit-Coach ๐Ÿ‹๏ธโ€โ™‚๏ธ

AI-Powered Real-Time Posture Monitoring & Coaching System

Edgefit-Coach is a comprehensive posture monitoring application built for the Qualcomm Edge AI Developer Hackathon. It combines real-time computer vision, AI coaching, and interactive dashboards to help users maintain healthy posture while working.

๐Ÿ“„ View Complete Project Presentation: EdgeFit Coach.pdf
Comprehensive overview with architecture diagrams, features, and technical specifications

๐ŸŽฅ Watch Live Demo: Live Demo Presentation.mp4
Real-time demonstration of posture monitoring, AI coaching, and system features

๐ŸŒŸ Key Features

๐ŸŽฏ Core Functionality

  • Real-Time Posture Detection: Advanced MediaPipe-based pose estimation with ONNX optimization
  • AI-Powered Coaching: Intelligent motivational quotes and personalized feedback
  • Stretching Exercise Detection: Automatic recognition of overhead reach and side stretch exercises
  • Desktop Notifications: Cross-platform notifications (Windows Toast, Linux notify2)
  • Interactive Dashboard: Comprehensive analytics with 6 key posture metrics
  • Chat Interface: AI-powered health coaching conversations
  • WebSocket Streaming: Real-time data updates and motivation quotes

๐Ÿ“Š Analytics & Insights

  • Posture Health Score: Overall posture quality (0-100%)
  • Slouch-to-Good Conversions: Improvement tracking
  • Consistency Index: Posture stability measurement
  • Session Success Rate: Performance over time
  • Recent Trend Score: Short-term progress tracking
  • Total Good Posture Minutes: Cumulative healthy posture time

๐Ÿ”ง Technical Features

  • FastAPI Backend: High-performance REST API with automatic documentation
  • Streamlit Frontend: Interactive web interface for testing and monitoring
  • WebSocket Support: Real-time bidirectional communication
  • ONNX Runtime: Optimized model inference for edge devices
  • Cross-Platform: Windows and Linux support
  • Headless Operation: Can run without GUI for server deployments

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.8+
  • Webcam/Camera access
  • Windows 10+ or Linux

Installation & Setup

  1. Clone the repository

    git clone <repository-url>
    cd Edgefit-Coach
  2. Install dependencies

    pip install -r requirements.txt
  3. Run the application

    python start_app.py

That's it! The application will automatically:

  • Start the WebSocket server (port 8001)
  • Launch the API server (port 8000)
  • Start the Streamlit frontend (port 8501)
  • Begin posture monitoring with main_webcam_headless1.py
  • Open your browser to http://localhost:8501

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Streamlit     โ”‚โ—„โ”€โ”€โ–บโ”‚   FastAPI        โ”‚โ—„โ”€โ”€โ–บโ”‚  Webcam Stream  โ”‚
โ”‚   Frontend      โ”‚    โ”‚   Server         โ”‚    โ”‚  (Headless)     โ”‚
โ”‚  (Port 8501)    โ”‚    โ”‚  (Port 8000)     โ”‚    โ”‚                 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                              โ”‚                          โ”‚
                              โ–ผ                          โ–ผ
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚  WebSocket       โ”‚    โ”‚  AI Processing  โ”‚
                    โ”‚  Server          โ”‚    โ”‚  - LLM Handler  โ”‚
                    โ”‚  (Port 8001)     โ”‚    โ”‚  - Pose Analysisโ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚  - Notificationsโ”‚
                                           โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“ Project Structure

Edgefit-Coach/
โ”œโ”€โ”€ ๐Ÿš€ start_app.py                 # Main application launcher
โ”œโ”€โ”€ ๐Ÿ”ง api_server.py               # FastAPI backend server
โ”œโ”€โ”€ ๐Ÿ“น main_webcam_headless1.py    # Headless posture monitoring
โ”œโ”€โ”€ ๐ŸŒ websocket_server.py         # WebSocket communication
โ”œโ”€โ”€ ๐ŸŽจ frontend_test.py            # Streamlit web interface
โ”œโ”€โ”€ ๐Ÿค– llm_handler.py              # AI chat and coaching
โ”œโ”€โ”€ ๐Ÿ“Š posture_db.py               # Data processing and analytics
โ”œโ”€โ”€ ๐Ÿ“ˆ dashboard_viewer.py         # Report generation
โ”œโ”€โ”€ โš™๏ธ config.yaml                 # Configuration settings
โ”œโ”€โ”€ ๐Ÿ“‹ requirements.txt            # Python dependencies
โ”œโ”€โ”€ ๐Ÿ“š API_DOCUMENTATION.md        # Detailed API docs
โ”œโ”€โ”€ ๐Ÿš€ QUICK_START.md              # Quick setup guide
โ”œโ”€โ”€ ๐Ÿ“– STARTUP_GUIDE.md            # Comprehensive startup guide
โ””โ”€โ”€ ๐Ÿ“„ EdgeFit Coach.pdf           # Project presentation & overview

๐Ÿ”Œ API Endpoints

Health & Status

  • GET /health - API health check
  • GET /files/status - File system status

Video Streaming

  • GET /video/start - Start posture monitoring
  • GET /video/stop - Stop monitoring
  • GET /video/status - Check stream status
  • WebSocket /ws/motivation - Real-time motivation quotes

Dashboard Analytics

  • GET /dashboard/data - Get comprehensive metrics
  • GET /dashboard/refresh - Force data refresh

AI Chat Interface

  • POST /chat/message - Send chat message
  • GET /chat/history - Retrieve conversation history
  • DELETE /chat/history - Clear chat history

Analysis & Reports

  • POST /analyze/report - Generate AI analysis report
  • GET /analyze/report-file - Download raw report

๐ŸŽฎ Usage Examples

Starting the System

# Single command to start everything
python start_app.py

Testing Individual Components

# Test API endpoints
python test_api_endpoints.py

# Run frontend only (requires API server running)
streamlit run frontend_test.py

# Start API server only
python api_server.py

Configuration

Edit config.yaml to customize:

api_key: "your-api-key"
model_server_base_url: "http://localhost:3001/api/v1"
workspace_slug: "edgefit"
stream: true
stream_timeout: 60

๐Ÿ” Key Components

Posture Detection Engine

  • MediaPipe Integration: Advanced pose landmark detection
  • ONNX Optimization: Faster inference on edge devices
  • Real-time Processing: 13+ FPS video analysis
  • Posture Classification: Good posture vs. slouching detection

AI Coaching System

  • Context-Aware Chat: Health and posture-focused conversations
  • Motivational Quotes: Dynamic, personalized encouragement
  • Performance Analysis: Detailed posture reports with recommendations
  • Goal Setting: Adaptive targets based on user progress

Stretching Exercise Detection

  • Overhead Reach: Both arms raised above head detection
  • Side Stretch: Left/right side stretching recognition
  • Real-time Feedback: Immediate exercise validation

Analytics Dashboard

  • 6 Core Metrics: Comprehensive posture health indicators
  • Trend Analysis: Historical performance tracking
  • Visual Charts: Interactive data visualization
  • Export Capabilities: Report generation and download

๐Ÿ› ๏ธ Development

Running Tests

# Comprehensive API testing
python test_api_endpoints.py

# WebSocket testing
python test_websocket_client.py

# Notification testing
python test_notifications.py

Adding New Features

  1. API Endpoints: Add to api_server.py
  2. Frontend Components: Modify frontend_test.py
  3. Posture Logic: Update main_webcam_headless1.py
  4. AI Features: Extend llm_handler.py

Dependencies

  • Core: FastAPI, OpenCV, MediaPipe, Streamlit
  • AI: Custom LLM integration
  • Notifications: win10toast (Windows), notify2 (Linux)
  • Optimization: ONNX Runtime
  • WebSocket: websockets, uvicorn

๐Ÿšจ Troubleshooting

Common Issues

  1. Port Conflicts: Ensure ports 8000, 8001, 8501 are available
  2. Camera Access: Check webcam permissions and availability
  3. Dependencies: Run pip install -r requirements.txt
  4. Performance: Enable ONNX Runtime for better performance

System Requirements

  • CPU: Multi-core processor recommended
  • RAM: 4GB+ for optimal performance
  • Camera: USB webcam or built-in camera
  • OS: Windows 10+ or Linux with GUI support

๐Ÿ“ˆ Performance Metrics

  • Video Processing: 13+ FPS real-time analysis
  • Response Time: <100ms for posture detection
  • AI Chat: 30-60 seconds for detailed analysis
  • Memory Usage: ~500MB typical operation
  • CPU Usage: 15-25% on modern processors

๐ŸŽฏ Use Cases

Personal Health

  • Remote Work: Maintain good posture during long work sessions
  • Health Monitoring: Track posture improvements over time
  • Exercise Guidance: Learn proper stretching techniques

Professional Applications

  • Corporate Wellness: Deploy in office environments
  • Healthcare: Physical therapy and rehabilitation support
  • Education: Ergonomics training and awareness

๐Ÿ”ฎ Future Enhancements

  • Mobile App: iOS/Android companion applications
  • Cloud Integration: Multi-user dashboard and analytics
  • Advanced AI: More sophisticated posture analysis
  • Wearable Integration: Smartwatch and fitness tracker support
  • Team Features: Group challenges and leaderboards

๐Ÿ“‹ Documentation

๐Ÿ“„ Project Presentation

For a comprehensive overview of the project, including architecture, features, and technical details, see:

  • EdgeFit Coach.pdf - Complete project presentation with visual diagrams, use cases, and technical specifications

๐Ÿ“š Additional Documentation

๐Ÿ“„ License

This project is licensed under the terms specified in the LICENSE file.

๐Ÿค Contributing

Built for the Qualcomm Edge AI Developer Hackathon. Contributions and feedback are welcome!


๐Ÿš€ Get started in seconds with python start_app.py

About

Building Edge Fit Coach application for Qualcomm Edge AI developer hackathon

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages