An open API service indexing awesome lists of open source software.

https://github.com/ksm26/video-analysis-agent


https://github.com/ksm26/video-analysis-agent

Last synced: about 2 months ago
JSON representation

Awesome Lists containing this project

README

          

# πŸŽ₯ Hercules Video Analysis Agent

## πŸ“‹ Project Overview

This project implements an automated Video Analysis Agent for Hercules test runs.

The agent evaluates whether the test run was executed as planned by comparing:

βœ… The agent's Planning Log (thoughts/steps)
βœ… Video recording(s) of the run
βœ… The final test output

**Deviation reports** are generated indicating if any claimed action was skipped, altered, or missing in the video evidence.

---

## βš™οΈ Features

- Modular, scalable Python codebase
- Step-by-step video inspection with YOLOv8-based action detection
- Final test output validation
- Lightweight AI assistance using `flan-t5-small` (runs on low-resource machines)
- Generates `.txt` and `.html` deviation reports
- Fully configurable via `configs/settings.py`

---

## πŸ—‚οΈ Project Structure

video_analysis_agent/

β”œβ”€β”€ agent\
β”‚Β Β  └── base_agent.py\
β”œβ”€β”€ config\
β”‚Β Β  β”œβ”€β”€ __init__.py\
β”‚Β Β  └── settings.py\
β”œβ”€β”€ data\
β”‚Β Β  β”œβ”€β”€ planning_logs\
β”‚Β Β  β”‚Β Β  └── run1.txt\
β”‚Β Β  β”œβ”€β”€ test_outputs\
β”‚Β Β  β”‚Β Β  └── run1_output.txt\
β”‚Β Β  └── videos\
β”‚Β Β  └── run1.mp4\
β”œβ”€β”€ models\
β”‚Β Β  └── yolov8s.pt\
β”œβ”€β”€ reports\
β”œβ”€β”€ requirements.txt\
β”œβ”€β”€ run_agent.py\
β”œβ”€β”€ run_agent_langchain.py\
β”œβ”€β”€ src\
β”‚Β Β  β”œβ”€β”€ deviation_engine.py\
β”‚Β Β  β”œβ”€β”€ __init__.py\
β”‚Β Β  β”œβ”€β”€ input_handler.py\
β”‚Β Β  β”œβ”€β”€ output_checker.py\
β”‚Β Β  β”œβ”€β”€ planning_parser.py\
β”‚Β Β  β”œβ”€β”€ report_generator.py\
β”‚Β Β  └── video_analyzer.py\
└── tools\
β”‚Β Β  β”œβ”€β”€ ai_tools.py\
β”‚ β”œβ”€β”€ __init__.py

---
## πŸš€ How to Run the Agent

### 1️⃣ Setup

Install requirements:

```bash
pip install -r requirements.txt
```

### 2️⃣ Place Input Files
Videos β†’ `data/videos/`

Planning Logs (`.txt`) β†’ `data/planning_logs/`

Final Output Files β†’ `data/test_outputs/`

Ensure filenames align (e.g., `run1.mp4`, `run1.txt`, `run1_output.txt`).

### 3️⃣ Run the Agent

```bash
python run_agent.py
```

Reports are generated in `reports/` with timestamps.

Example:

`reports/run1_detailed_report_20240628_153020.txt` \
`reports/run1_detailed_report_20240628_153020.html`

### πŸ“Š Outlines
`Video β†’ Frames β†’ YOLO Detections β†’ AI Agent` \
` AI Agent: `\
` - Uses LLM to parse Planning Log (extract steps)` \
` - Matches steps to YOLO results (Was action observed?) `\
` - Flags deviations or missing actions` \
` - Generates final report with reasoning`

### πŸ“Š Sample Output

```bash
Test Report Details
Test Suite: run1
==================================================
Total Duration: 87.63 sec
Total Token Used: 43
Total Cost Estimate: 9e-05 USD

Test Result Summary
--------------------------------------------------
Steps Passed: 0
Steps Failed: 3

Detailed Steps:
--------------------------------------------------
Step 1: ο»ΏClick "Login"
Result: ❌ Deviation
Notes: Action not found in video

Step 2: Enter Password
Result: ❌ Deviation
Notes: Action not found in video

Step 3: Submit Form
Result: ❌ Deviation
Notes: Action not found in video

Output File: data/test_outputs/run1_output.txt
Proofs Video: data/videos/run1.mp4
Planner Thoughts Log: ./log_files/run1_planner_thoughts.log
Chat Messages Log: ./log_files/run1_chat_messages.log
```

### πŸ›  Requirements
- Python 3.8+
- Tested with flan-t5-small for AI tasks
- Uses YOLOv8 for action detection
- Low hardware requirements (8GB RAM compatible)

### πŸ“š References
- [Hercules GitHub](https://github.com/test-zeus-ai/testzeus-hercules)