Skip to content

shyam3089/Baby-Monitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Smart Baby Monitor πŸ‘ΆπŸ“Ή

A comprehensive AI-powered baby monitoring system with advanced sleeping position detection, face recognition, and safety alerts.

🌟 Key Features

πŸ›οΈ Sleeping Position Detection

  • Real-time Position Tracking: Detects back, side, and prone sleeping positions
  • MediaPipe Integration: Uses advanced pose estimation for accurate detection
  • Safety Alerts: Immediate notifications for unsafe prone positions
  • Confidence Scoring: Reliability metrics for each detection
  • Visual Overlays: Bounding boxes and pose landmarks on video feed

πŸ‘Ά Face & Eye Detection

  • Enhanced Face Detection: Supports side faces and partial visibility
  • Eye State Monitoring: Detects open/closed eyes for sleep analysis
  • Face Orientation: Determines viewing angle and profile type
  • Robust Tracking: Handles face loss and recovery gracefully

😴 Sleep State Analysis

  • Multi-factor Detection: Combines motion, sound, face, and eye data
  • Smart State Logic: Accurate sleeping/awake/unknown classifications
  • Context Awareness: Considers all available information for decisions

🎡 Audio Monitoring

  • Cry Detection: AI-powered baby cry identification
  • Sound Level Tracking: Real-time audio level visualization
  • Background Processing: Continuous audio analysis

πŸ“± Web Dashboard

  • Live Video Feed: Real-time video with position overlays
  • Status Monitoring: Current position, confidence, and sleep state
  • Interactive Controls: Pause, resume, and configuration options
  • Responsive Design: Works on desktop and mobile devices

🚨 Safety & Alerts

  • Prone Position Alerts: Warnings for stomach-down sleeping
  • Face Loss Monitoring: Alerts when baby is not visible
  • Automatic Recording: Captures video during safety events
  • Configurable Thresholds: Customizable alert sensitivity

πŸš€ Quick Start

Prerequisites

  • Python 3.8 or higher
  • Webcam or camera device
  • Microphone (optional, for audio monitoring)

Installation

  1. Clone the repository

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

    pip install -r requirements.txt
  3. Configure settings (optional)

    # Edit config/settings.json to customize detection thresholds
  4. Run the system

    python src/main.py
  5. Access dashboard

    • Open browser to http://localhost:5001
    • View live feed and monitoring data

πŸ“‹ System Requirements

Hardware

  • Camera: USB webcam or built-in camera
  • CPU: Intel i5 or equivalent (for real-time processing)
  • RAM: 4GB minimum, 8GB recommended
  • Storage: 1GB free space (for recordings)

Software

  • OS: Windows 10/11, macOS 10.14+, or Linux
  • Python: 3.8, 3.9, 3.10, or 3.11
  • Browser: Chrome, Firefox, Safari, or Edge

πŸ”§ Configuration

Settings File: config/settings.json

{
  "detection": {
    "position": {
      "enabled": true,
      "confidence_threshold": 0.6,
      "alert_prone_time": 300
    },
    "face": {
      "min_detection_confidence": 0.5,
      "ear_threshold": 0.2,
      "face_loss_timeout": 10
    },
    "sleep": {
      "motion_threshold": 5,
      "sound_threshold": 0.02,
      "consecutive_frames": 90
    }
  }
}

Key Configuration Options

  • Position Detection: Enable/disable and set confidence thresholds
  • Alert Timing: How long to wait before triggering prone position alerts
  • Face Detection: Sensitivity and tracking parameters
  • Sleep Detection: Motion and sound thresholds for sleep determination

πŸ“Š Position Detection Guide

🟒 Back Position (Safest)

  • Baby lying on back, face visible and upward
  • Shoulders and hips symmetric
  • Safety: Recommended sleeping position
  • Color Code: Green

🟑 Side Position (Monitor Closely)

  • Baby lying on side, one shoulder/hip higher
  • May show profile view of face
  • Safety: Generally safe but monitor
  • Color Code: Orange

πŸ”΄ Prone Position (Safety Concern)

  • Baby lying on stomach, face may not be visible
  • Body oriented horizontally
  • Safety: Immediate attention needed
  • Color Code: Red

βšͺ Unknown Position

  • Insufficient data for reliable detection
  • Baby not clearly visible or pose unclear
  • Safety: Manual verification recommended
  • Color Code: Gray

πŸ§ͺ Testing & Validation

Quick Test

python quick_test.py

Verifies all modules are working correctly.

Integration Test

python test_integration.py

Comprehensive testing of all system components.

Interactive Demo

python demo_position_detection.py

Live demonstration of position detection features.

πŸ“ Project Structure

ProjectBBY/
β”œβ”€β”€ src/                          # Source code
β”‚   β”œβ”€β”€ main.py                   # Main application
β”‚   β”œβ”€β”€ position_detector.py     # Position detection (NEW)
β”‚   β”œβ”€β”€ face_detector.py         # Face & eye detection
β”‚   β”œβ”€β”€ sleep_detector.py        # Sleep state analysis
β”‚   β”œβ”€β”€ motion_detector.py       # Motion detection
β”‚   β”œβ”€β”€ cry_detector.py          # Audio cry detection
β”‚   β”œβ”€β”€ alert_manager.py         # Alert system
β”‚   β”œβ”€β”€ recorder.py              # Video recording
β”‚   └── gui/
β”‚       └── dashboard.py         # Web dashboard
β”œβ”€β”€ templates/                    # Web templates
β”‚   └── index.html               # Dashboard interface
β”œβ”€β”€ static/                       # Web assets
β”‚   β”œβ”€β”€ style.css                # Dashboard styling
β”‚   └── script.js                # Dashboard JavaScript
β”œβ”€β”€ config/                       # Configuration
β”‚   └── settings.json            # System settings
β”œβ”€β”€ media/                        # Recordings storage
β”œβ”€β”€ logs/                         # System logs
└── tests/                        # Test files

πŸ”§ Troubleshooting

Common Issues

Camera Not Working

  • Check camera permissions
  • Verify camera device ID in settings
  • Try different USB port or camera

High CPU Usage

  • Reduce video resolution in settings
  • Lower detection confidence thresholds
  • Close other resource-intensive applications

Position Detection Inaccurate

  • Ensure good lighting conditions
  • Check camera angle and distance
  • Adjust confidence thresholds in config

Dashboard Not Loading

  • Check if port 5001 is available
  • Verify firewall settings
  • Try different browser

Debug Mode

Enable detailed logging by setting log level to DEBUG in config/settings.json:

{
  "logging": {
    "level": "DEBUG"
  }
}

πŸ›‘οΈ Safety Disclaimers

⚠️ Important Safety Notes:

  • This system is a monitoring aid, NOT a medical device
  • Always follow safe sleep guidelines from pediatric experts
  • Do not rely solely on automated alerts for baby safety
  • Regularly check on your baby regardless of system status
  • Consult healthcare professionals for sleep safety advice

πŸ”§ Development

Adding New Features

  1. Create feature branch
  2. Implement changes with tests
  3. Update documentation
  4. Submit pull request

Code Style

  • Follow PEP 8 guidelines
  • Add docstrings to all functions
  • Include type hints where applicable
  • Write unit tests for new features

πŸ“œ License

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

🀝 Contributing

Contributions are welcome! Please read our contributing guidelines and submit pull requests for any improvements.

πŸ“ž Support

For support, questions, or feature requests:

  • Create an issue on GitHub
  • Check the troubleshooting section
  • Review the documentation

πŸ”„ Version History

v2.0.0 (Current)

  • βœ… Added sleeping position detection
  • βœ… Enhanced face detection with side face support
  • βœ… Improved sleep state logic
  • βœ… Updated dashboard with position display
  • βœ… Added safety alerts and visual overlays

v1.0.0

  • Basic video monitoring
  • Face and eye detection
  • Motion detection
  • Audio cry detection
  • Web dashboard

Made with ❀️ for baby safety and parental peace of mind

About

This is a baby monitor app under development

Resources

Stars

Watchers

Forks

Packages

No packages published