Belajar vision AI
Go to file
2025-09-30 03:58:56 +00:00
.gitignore add Human Activity Recognition using SlowFast 2025-08-11 16:59:34 +07:00
activity_analyzer.py Update activity_analyzer.py 2025-09-30 03:58:56 +00:00
compliance_report.json add Human Activity Recognition using SlowFast 2025-08-11 16:59:34 +07:00
demo.py add Human Activity Recognition using SlowFast 2025-08-11 16:59:34 +07:00
kinetics_classnames.json add Human Activity Recognition using SlowFast 2025-08-11 16:59:34 +07:00
main2.py add Human Activity Recognition using SlowFast 2025-08-11 16:59:34 +07:00
main3.py add Human Activity Recognition using SlowFast 2025-08-11 16:59:34 +07:00
main4.py add Human Activity Recognition using SlowFast 2025-08-11 16:59:34 +07:00
main.py initial commit 2024-12-14 04:10:29 +00:00
README.md add Human Activity Recognition using SlowFast 2025-08-11 16:59:34 +07:00
requirements.txt add Human Activity Recognition using SlowFast 2025-08-11 16:59:34 +07:00
sequence.txt add Human Activity Recognition using SlowFast 2025-08-11 16:59:34 +07:00
yolo11m-2_uniform.onnx add Human Activity Recognition using SlowFast 2025-08-11 16:59:34 +07:00
yolo11s-pose.pt initial commit 2024-12-14 04:10:29 +00:00

SOP Compliance Analyzer

This program analyzes human activity in videos to check if workers are following Standard Operating Procedures (SOPs). It uses computer vision techniques to detect people, estimate their poses, classify activities, and evaluate compliance with predefined SOPs.

Features

  • Person detection using YOLO model
  • Pose estimation for activity analysis
  • Activity classification (SOP compliance checking)
  • Real-time video analysis with visual feedback
  • Compliance reporting and logging
  • Person tracking across video frames

Requirements

  • Python 3.7+
  • OpenCV
  • PyTorch
  • ONNX Runtime
  • Ultralytics YOLO
  • NumPy
  • PyTorchVideo (for MobileNet3D support)

Installation

  1. Install the required packages:
    pip install -r requirements.txt
    

Usage

  1. Prepare your video file and models:

    • Place your video file in the project directory
    • Ensure you have the YOLO models (yolo11m-2_uniform.onnx and yolo11s-pose.pt)
  2. Run the analyzer:

    python activity_analyzer.py
    
  3. View the results:

    • Real-time video display with compliance indicators
    • Compliance report saved to compliance_report.json
    • Summary statistics printed to console

How It Works

  1. Person Detection: Uses YOLO to detect people in each video frame
  2. Person Tracking: Tracks individuals across frames using IoU-based matching
  3. Pose Estimation: Estimates body pose for each detected person
  4. Activity Classification: Classifies activities based on pose patterns
  5. SOP Compliance Check: Evaluates if activities comply with predefined SOPs
  6. Visualization: Displays results with color-coded bounding boxes
  7. Reporting: Generates detailed compliance reports

SOP Activities

The program recognizes the following SOP-compliant activities:

  • Speaking with customer
  • Inputting order
  • Giving item to customer
  • Cleaning table

Non-compliant activities detected:

  • Using mobile phone
  • Talking with colleagues
  • Idle behavior

Customization

You can customize the program by modifying:

  • Activity definitions in the sop_activities and non_compliant_activities lists
  • Confidence thresholds for detection and classification
  • Tracking parameters
  • Compliance rules in the check_sop_compliance method

Output

The program generates:

  1. Real-time video display with bounding boxes (green= compliant, red=non-compliant)
  2. compliance_report.json with detailed activity logs
  3. Console summary with compliance statistics

Troubleshooting

If you encounter issues:

  1. Ensure all required models are in the correct location
  2. Check that your video file is accessible
  3. Verify all dependencies are installed correctly
  4. Adjust confidence thresholds if detection is inaccurate