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_summaryattribute to store the latest pose detection results - Removed the
_annotate_pose_banner()call fromprocess_frame()method - Now stores pose information in
self.last_pose_summaryinstead of drawing it on the frame
API Updates
- Updated
/api/live-statsendpoint to includepose_analysisdata:{ "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)
- HIGH_RISK: Red (
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 bothapp.pyandwebapp/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
app.py- VideoProcessor and /api/live-stats endpointwebapp/app.py- VideoProcessor and /api/live-stats endpointwebapp/templates/live_camera.html- Added Pose Analysis sectionwebapp/static/js/live_camera.js- Enhanced updateLiveStats() function
Related Documentation
Version: 2.1
Date: May 2026
Impact: UI/UX Improvement, No breaking changes