-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_agent_quick.py
More file actions
77 lines (61 loc) · 2.32 KB
/
test_agent_quick.py
File metadata and controls
77 lines (61 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
"""
E-Raksha Agent Quick Test Suite
Rapid validation test for the complete agent system using 10 representative videos.
Provides fast feedback on system functionality and ensemble performance.
Author: E-Raksha Team
"""
import sys
import os
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent / "src"))
from agent.eraksha_agent import ErakshAgent
# Test dataset configuration
TEST_DATA_ROOT = Path("_archive/test-files/test-data/test-data/raw")
real_videos = sorted((TEST_DATA_ROOT / "real").glob("*.mp4"))[:5]
fake_videos = sorted((TEST_DATA_ROOT / "fake").glob("*.mp4"))[:5]
print("=" * 70)
print("E-RAKSHA AGENT QUICK TEST - 10 VIDEOS")
print("=" * 70)
# Initialize agent system
agent = ErakshAgent()
# Execute test
results = []
correct = 0
print("\n" + "=" * 70)
print("TESTING REAL VIDEOS")
print("=" * 70)
for video_path in real_videos:
result = agent.predict(str(video_path))
if result['success']:
pred = result['prediction']
conf = result['confidence']
is_correct = pred == 'REAL'
if is_correct:
correct += 1
status = "✅" if is_correct else "❌"
print(f"{status} {video_path.name}: {pred} ({conf:.1%})")
results.append({'video': video_path.name, 'true': 'REAL', 'pred': pred, 'correct': is_correct})
print("\n" + "=" * 70)
print("TESTING FAKE VIDEOS")
print("=" * 70)
for video_path in fake_videos:
result = agent.predict(str(video_path))
if result['success']:
pred = result['prediction']
conf = result['confidence']
is_correct = pred == 'FAKE'
if is_correct:
correct += 1
status = "✅" if is_correct else "❌"
print(f"{status} {video_path.name}: {pred} ({conf:.1%})")
results.append({'video': video_path.name, 'true': 'FAKE', 'pred': pred, 'correct': is_correct})
# Summary
print("\n" + "=" * 70)
print("SUMMARY")
print("=" * 70)
total = len(results)
real_correct = sum(1 for r in results if r['true'] == 'REAL' and r['correct'])
fake_correct = sum(1 for r in results if r['true'] == 'FAKE' and r['correct'])
print(f"Overall: {correct}/{total} ({correct/total*100:.1f}%)")
print(f"Real: {real_correct}/5 ({real_correct/5*100:.1f}%)")
print(f"Fake: {fake_correct}/5 ({fake_correct/5*100:.1f}%)")