Skip to content

Mrabbi3/LiftProofAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒ Live Website: https://liftproof-ai-website-7oediq4sy-md-s-projects-90825e24.vercel.app/

LiftProof.Ai is an advanced real-time shoplifting detection system that uses YOLOv8-Pose for skeleton tracking combined with behavioral analysis algorithms to identify potential theft in retail environments. Unlike traditional object detection systems, LiftProof.Ai analyzes human behavior patterns to detect concealment actions before items leave the store.

๐ŸŽฏ Problem It Solves

  • $100+ billion lost annually to retail theft globally
  • Traditional CCTV requires constant human monitoring
  • Object-based detection fails to catch concealment behaviors
  • Existing solutions are expensive and complex

๐Ÿ’ก Our Solution

LiftProof.Ai provides:

  • Real-time behavioral analysis using pose estimation
  • Multi-camera support for major CCTV brands
  • Instant alerts to security personnel
  • Evidence capture with timestamps and video clips
  • Cost-effective deployment on standard hardware

โœจ Features

Core Detection Capabilities

Feature Description
๐Ÿ–๏ธ Pocket Concealment Detects hand-to-pocket movements indicating item hiding
๐Ÿ‘• Under-Shirt Hiding Identifies items being tucked under clothing
๐Ÿฉณ Waistband Concealment Monitors waistband area for hiding behavior
โšก Quick Grab Detection Catches rapid snatching movements
๐Ÿ‘€ Nervous Behavior Tracks suspicious head movements and looking around

Technical Features

  • โœ… Real-time Processing - 30+ FPS on modern hardware
  • โœ… Multi-Person Tracking - Track multiple subjects simultaneously
  • โœ… Skeleton Visualization - Full 17-keypoint pose estimation
  • โœ… Progressive Alerts - Normal โ†’ Watching โ†’ Suspicious โ†’ Alert
  • โœ… Suspicion Scoring - 0-100% risk assessment per person
  • โœ… Evidence Capture - Automatic screenshot/video on alert
  • โœ… CCTV Integration - Works with Hikvision, Dahua, Lorex, UNV, and more

๐Ÿš€ Installation

Prerequisites

  • Python 3.8 or higher
  • Webcam or CCTV camera (RTSP compatible)
  • macOS, Windows, or Linux

Quick Install

# Clone the repository
git clone https://github.com/Mrabbi3/LiftProofAI.git
cd LiftProofAI

# Create virtual environment
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

Requirements

ultralytics>=8.1.0
opencv-python>=4.8.0
numpy>=1.24.0
torch>=2.0.0

Download YOLOv8-Pose Model

The model downloads automatically on first run, or manually:

python3 -c "from ultralytics import YOLO; YOLO('yolov8n-pose.pt')"

๐Ÿ“– Usage

Basic Usage (Webcam)

# Activate virtual environment
source venv/bin/activate

# Run detection
python3 liftproof_v2.py

With CCTV Camera

python3 main.py --camera rtsp://admin:password@192.168.1.64:554/stream1

Testing the System

Once running, test these behaviors:

Action Expected Response
Stand normally ๐ŸŸข Green skeleton - "NORMAL"
Hand in pocket (hold 1-2 sec) ๐ŸŸกโ†’๐ŸŸ โ†’๐Ÿ”ด Alert triggered
Hand to waistband ๐ŸŸกโ†’๐ŸŸ โ†’๐Ÿ”ด Alert triggered
Hand under shirt ๐ŸŸกโ†’๐ŸŸ โ†’๐Ÿ”ด Alert triggered
Quick grabbing motion Rapid score increase
Look around nervously "NERVOUS_LOOKING" detected

Keyboard Controls

Key Action
Q Quit application
S Save screenshot
R Reset tracking

๐Ÿง  How It Works

Architecture Overview

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                        LiftProof.Ai                             โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                                 โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚  โ”‚  Camera  โ”‚โ”€โ”€โ”€โ–ถโ”‚  YOLOv8-Pose โ”‚โ”€โ”€โ”€โ–ถโ”‚  Behavioral Analysis  โ”‚ โ”‚
โ”‚  โ”‚  Input   โ”‚    โ”‚  Detection   โ”‚    โ”‚       Engine          โ”‚ โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚                         โ”‚                        โ”‚              โ”‚
โ”‚                         โ–ผ                        โ–ผ              โ”‚
โ”‚                  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”       โ”‚
โ”‚                  โ”‚  Skeleton   โ”‚         โ”‚  Suspicion  โ”‚       โ”‚
โ”‚                  โ”‚  Tracking   โ”‚         โ”‚   Scoring   โ”‚       โ”‚
โ”‚                  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜       โ”‚
โ”‚                         โ”‚                        โ”‚              โ”‚
โ”‚                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜              โ”‚
โ”‚                                    โ–ผ                            โ”‚
โ”‚                          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                    โ”‚
โ”‚                          โ”‚  Alert System   โ”‚                    โ”‚
โ”‚                          โ”‚  & Notification โ”‚                    โ”‚
โ”‚                          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                    โ”‚
โ”‚                                                                 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Detection Pipeline

  1. Frame Capture - Video input from webcam or RTSP stream
  2. Pose Estimation - YOLOv8-Pose extracts 17 body keypoints
  3. Person Tracking - Persistent IDs across frames
  4. Behavior Analysis - Analyze keypoint positions and movements
  5. Temporal Analysis - Track behavior duration over time
  6. Risk Scoring - Calculate 0-100% suspicion score
  7. Alert Generation - Trigger alerts when threshold exceeded

Body Keypoints Used

        0: Nose
       / \
      1   2: Eyes
     /     \
    3       4: Ears
     \     /
      5โ”€โ”€โ”€6: Shoulders
      โ”‚   โ”‚
      7   8: Elbows
      โ”‚   โ”‚
      9  10: Wrists โ† Primary detection points
      โ”‚   โ”‚
     11โ”€โ”€12: Hips โ† Primary detection points
      โ”‚   โ”‚
     13  14: Knees
      โ”‚   โ”‚
     15  16: Ankles

โš™๏ธ Configuration

Detection Thresholds

Edit these in liftproof_v2.py to tune sensitivity:

self.config = {
    # Distance thresholds (relative to body height)
    'POCKET_THRESHOLD': 0.12,      # Hand near pocket
    'WAIST_THRESHOLD': 0.10,       # Hand at waistband
    'CHEST_THRESHOLD': 0.15,       # Hand under shirt
    
    # Time thresholds (frames at ~30fps)
    'POCKET_FRAMES': 25,           # ~0.8 sec to trigger
    'WAIST_FRAMES': 20,            # ~0.7 sec to trigger
    'CHEST_FRAMES': 25,            # ~0.8 sec to trigger
    
    # Alert thresholds
    'ALERT_THRESHOLD': 70,         # Score to trigger alert
    'SUSPICIOUS_THRESHOLD': 40,    # Score for suspicious
    'WATCHING_THRESHOLD': 20,      # Score to start watching
}

Supported CCTV Brands

Brand RTSP URL Format
Hikvision rtsp://{user}:{pass}@{ip}:554/Streaming/Channels/{ch}01
Dahua rtsp://{user}:{pass}@{ip}:554/cam/realmonitor?channel={ch}
Lorex rtsp://{user}:{pass}@{ip}:554/ch{ch}/main
Uniview (UNV) rtsp://{user}:{pass}@{ip}:554/unicast/c{ch}/s0/live
Reolink rtsp://{user}:{pass}@{ip}:554/h264Preview_{ch}_main

๐Ÿ“ Project Structure

LiftProofAI/
โ”œโ”€โ”€ liftproof_v2.py          # Main detection script (recommended)
โ”œโ”€โ”€ main.py                   # Multi-camera orchestrator
โ”œโ”€โ”€ test_webcam.py           # Simple webcam test
โ”œโ”€โ”€ requirements.txt          # Python dependencies
โ”œโ”€โ”€ README.md                 # This file
โ”œโ”€โ”€ LICENSE                   # MIT License
โ”œโ”€โ”€ .gitignore               # Git ignore rules
โ”‚
โ”œโ”€โ”€ config/
โ”‚   โ””โ”€โ”€ settings.py          # Configuration settings
โ”‚
โ”œโ”€โ”€ modules/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ detection_engine.py  # Core detection logic
โ”‚   โ”œโ”€โ”€ rtsp_loader.py       # CCTV stream handler
โ”‚   โ””โ”€โ”€ notification_manager.py
โ”‚
โ”œโ”€โ”€ models/                   # Trained models (git-ignored)
โ”œโ”€โ”€ data/evidence/           # Captured alert images
โ”œโ”€โ”€ logs/                     # Application logs
โ””โ”€โ”€ assets/                   # Documentation assets

๐Ÿ“Š Performance

Benchmarks

Hardware Resolution FPS Persons Tracked
MacBook Air M1 720p 25-30 Up to 5
MacBook Pro M2 1080p 30+ Up to 10
RTX 3060 1080p 45+ Up to 15
RTX 4090 4K 60+ Up to 20+

Model Options

Model Size Speed Accuracy
yolov8n-pose.pt 6 MB Fastest Good
yolov8s-pose.pt 23 MB Fast Better
yolov8m-pose.pt 52 MB Medium Best

๐Ÿ”ฎ Roadmap

  • Basic pose detection
  • Behavioral analysis engine
  • Multi-person tracking
  • Webcam support
  • CCTV integration
  • Mobile app notifications (Firebase)
  • SMS alerts (Twilio)
  • Web dashboard
  • Cloud deployment
  • Custom model training pipeline

๐Ÿค Contributing

Contributions are welcome! Here's how:

  1. Fork the repository
  2. Create your feature branch: git checkout -b feature/AmazingFeature
  3. Commit your changes: git commit -m 'Add some AmazingFeature'
  4. Push to the branch: git push origin feature/AmazingFeature
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License


โš ๏ธ Disclaimer

This software is intended for legitimate security purposes only. Users are responsible for:

  • Complying with local privacy laws and regulations
  • Obtaining necessary permissions for surveillance
  • Proper signage indicating video monitoring
  • Ethical use of the technology

๐Ÿ“ž Support


๐Ÿ™ Acknowledgments


Built with โค๏ธ for retail security

โญ Star this repo if you find it useful!

About

LiftProofAI is made for keeping shoplift free community. It integrates seamlessly with CC TV cameras around store and detects and suspicious behavior and sends instant notification to the owners or guards mobile app. Our Machine Learning model is very accurate and precise. So, lets build our community with LiftProofAI

Resources

License

Stars

2 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages