62 lines
1.8 KiB
Python
62 lines
1.8 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Demo script to run the SOP Compliance Analyzer
|
|
"""
|
|
|
|
import subprocess
|
|
import sys
|
|
import os
|
|
|
|
def main():
|
|
print("SOP Compliance Analyzer Demo")
|
|
print("============================")
|
|
print()
|
|
print("This demo will run the activity analyzer on the sample video.")
|
|
print("The analyzer will:")
|
|
print("1. Detect people in the video")
|
|
print("2. Track them across frames")
|
|
print("3. Estimate their poses")
|
|
print("4. Classify their activities")
|
|
print("5. Check for SOP compliance")
|
|
print("6. Generate a compliance report")
|
|
print("7. Save annotated video with labels to MP4 format")
|
|
print()
|
|
print("Press 'q' at any time to quit the video display.")
|
|
print()
|
|
input("Press Enter to start the analysis...")
|
|
|
|
# Run the activity analyzer
|
|
try:
|
|
result = subprocess.run([sys.executable, "activity_analyzer.py"],
|
|
capture_output=True, text=True, timeout=300)
|
|
|
|
print("\nAnalysis completed!")
|
|
print(f"Return code: {result.returncode}")
|
|
|
|
if result.stdout:
|
|
print("\nOutput:")
|
|
print(result.stdout)
|
|
|
|
if result.stderr:
|
|
print("\nErrors:")
|
|
print(result.stderr)
|
|
|
|
except subprocess.TimeoutExpired:
|
|
print("Analysis timed out after 5 minutes")
|
|
except Exception as e:
|
|
print(f"Error running analysis: {e}")
|
|
|
|
# Check if report was generated
|
|
if os.path.exists("compliance_report.json"):
|
|
print("\nCompliance report generated successfully!")
|
|
# Get file size
|
|
size = os.path.getsize("compliance_report.json")
|
|
print(f"Report size: {size} bytes")
|
|
else:
|
|
print("\nNo compliance report found.")
|
|
|
|
print("\nDemo completed.")
|
|
|
|
if __name__ == "__main__":
|
|
main()
|