NETRA-AI_Video_Surveillance_Web_Application / docs /POSE_ANALYSIS_RELOCATION.md
itsluckysharma01's picture
Upload 39 files
cb3c674 verified

Pose Analysis Display Relocation

Overview

The Pose Risk, Action, and Score information has been moved from the live video frame to the Behavior Analysis panel in the alerts section for a cleaner camera view.

Changes Made

1. Backend Changes (app.py & webapp/app.py)

VideoProcessor Class

  • Added last_pose_summary attribute to store the latest pose detection results
  • Removed the _annotate_pose_banner() call from process_frame() method
  • Now stores pose information in self.last_pose_summary instead of drawing it on the frame

API Updates

  • Updated /api/live-stats endpoint to include pose_analysis data:
    {
      "pose_analysis": {
        "risk_level": "SAFE|LOW_RISK|HIGH_RISK",
        "action": "standing|walking|running|etc",
        "risk_score": 0.0-1.0
      }
    }
    

2. Frontend Changes

HTML Template (live_camera.html)

  • Added new Pose Analysis section in the alerts panel
  • Displays:
    • 🧍 Risk Level: Color-coded status (Green=SAFE, Orange=LOW_RISK, Red=HIGH_RISK)
    • Action: Current action being detected
    • Score: Risk score with 2 decimal places
  • Uses orange color scheme (--orange-100, --orange-600) to distinguish from other sections

JavaScript (live_camera.js)

  • Enhanced updateLiveStats() function to fetch pose data from /api/live-stats
  • Automatically updates HTML elements:
    • #pose-risk-level
    • #pose-action
    • #pose-score
  • Implements dynamic color coding:
    • HIGH_RISK: Red (--danger)
    • LOW_RISK: Orange (--orange-600)
    • SAFE: Green (--ok)

Benefits

βœ… Cleaner Video Frame: No overlays cluttering the live camera feed βœ… Better Organization: Pose info grouped with other behavioral analysis βœ… Real-time Updates: Stats poll every second with latest pose data βœ… Visual Hierarchy: Color-coded risk levels for quick assessment βœ… Responsive Design: Works on all screen sizes

Display Location

Before

[Video Frame]
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Pose Risk: HIGH_RISK | Action: ...  ← Overlaid on video
β”‚  (Cluttering the view)
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

After

[Video Frame - Clean]              [Alerts Panel]
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  β”‚              β”‚ 🚨 Alerts    β”‚
β”‚   Clear View!    β”‚              β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                  β”‚              β”‚ πŸ“Š Statisticsβ”‚
β”‚                  β”‚              β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β”‚ 🧍 Pose      β”‚
                                  β”‚  Risk: SAFE  β”‚
                                  β”‚  Score: 0.00 β”‚
                                  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Configuration

The pose banner drawing method (_annotate_pose_banner) is still available if needed for other views:

  • Location: VideoProcessor._annotate_pose_banner() in both app.py and webapp/app.py
  • Can be re-enabled by uncommenting the call in process_frame()

Testing Checklist

  • βœ… Live camera starts without pose banner on frame
  • βœ… Pose Analysis section appears in alerts panel
  • βœ… Risk level updates in real-time (every ~1 second)
  • βœ… Action label shows current detected action
  • βœ… Score displays with 2 decimal places
  • βœ… Colors change based on risk level (Green/Orange/Red)
  • βœ… Works on mobile (640px) and tablet (960px) viewports
  • βœ… No console errors in browser dev tools

Files Modified

  1. app.py - VideoProcessor and /api/live-stats endpoint
  2. webapp/app.py - VideoProcessor and /api/live-stats endpoint
  3. webapp/templates/live_camera.html - Added Pose Analysis section
  4. webapp/static/js/live_camera.js - Enhanced updateLiveStats() function

Related Documentation


Version: 2.1
Date: May 2026
Impact: UI/UX Improvement, No breaking changes