File size: 2,047 Bytes
0cbed7c | 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 | #!/usr/bin/env python3
"""
Evaluate a single Qwen-VL model variant on PVSG dataset
"""
import argparse
import sys
from pathlib import Path
from evaluator import PVSGEvaluator
from config import MODELS
def main():
parser = argparse.ArgumentParser(description="Evaluate Qwen-VL model on PVSG dataset")
parser.add_argument(
"--model_variant",
choices=list(MODELS.keys()),
required=True,
help="Model variant to evaluate"
)
parser.add_argument(
"--device",
default="auto",
help="Device to use for inference (auto, cuda, cpu)"
)
parser.add_argument(
"--max_videos",
type=int,
default=None,
help="Maximum number of videos to evaluate (default: all test videos)"
)
parser.add_argument(
"--no_save_intermediate",
action="store_true",
help="Don't save intermediate checkpoints"
)
args = parser.parse_args()
print(f"Starting evaluation of {args.model_variant} model")
print(f"Model config: {MODELS[args.model_variant]}")
# Create evaluator
evaluator = PVSGEvaluator(
model_variant=args.model_variant,
device=args.device,
max_videos=args.max_videos
)
# Run evaluation
try:
results = evaluator.evaluate_all_videos(
save_intermediate=not args.no_save_intermediate
)
# Print summary
summary = evaluator.get_evaluation_summary()
print("\\n" + "="*50)
print("EVALUATION SUMMARY")
print("="*50)
for key, value in summary.items():
print(f"{key}: {value}")
print(f"\\nEvaluation completed successfully!")
print(f"Results saved in: {Path(__file__).parent / 'results'}")
except KeyboardInterrupt:
print("\\nEvaluation interrupted by user")
sys.exit(1)
except Exception as e:
print(f"\\nError during evaluation: {e}")
sys.exit(1)
if __name__ == "__main__":
main() |