Execute main script logic to test OCR performance on debug frames.
()
| 851 | |
| 852 | |
| 853 | def main(): |
| 854 | """Execute main script logic to test OCR performance on debug frames.""" |
| 855 | rapid = RapidOCRBackend.pp_ocr_v5_rec() |
| 856 | |
| 857 | # Try to load Qwen2-VL for rankings (mirrors production _select_ocr_backend) |
| 858 | qwen = None |
| 859 | if QwenVLOCRBackend.has_sufficient_vram(): |
| 860 | print("[rankings] GPU detected — using Qwen2-VL-2B for DR/SA rankings.") |
| 861 | qwen = QwenVLOCRBackend() |
| 862 | else: |
| 863 | print( |
| 864 | "[rankings] No GPU / insufficient VRAM — using RapidOCR for DR/SA rankings." |
| 865 | ) |
| 866 | |
| 867 | test_activeness(rapid) |
| 868 | test_chest_contributions(rapid) |
| 869 | |
| 870 | # Find all ranking prefixes dynamically (dr_*, sa_*) |
| 871 | dr_prefixes = sorted( |
| 872 | {"_".join(p.name.split("_")[:2]) for p in SCREENSHOTS_DIR.glob("dr_*.png")} |
| 873 | ) |
| 874 | sa_prefixes = sorted( |
| 875 | {"_".join(p.name.split("_")[:2]) for p in SCREENSHOTS_DIR.glob("sa_*.png")} |
| 876 | ) |
| 877 | |
| 878 | for prefix in dr_prefixes: |
| 879 | test_rankings( |
| 880 | rapid, qwen, prefix, f"DREAM REALM — {prefix}", is_supreme_arena=False |
| 881 | ) |
| 882 | |
| 883 | for prefix in sa_prefixes: |
| 884 | test_rankings( |
| 885 | rapid, qwen, prefix, f"SUPREME ARENA — {prefix}", is_supreme_arena=True |
| 886 | ) |
| 887 | |
| 888 | |
| 889 | if __name__ == "__main__": |
no test coverage detected