From 7971ad7996858f51c6e3ba7b03dee44e54d1637c Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Mon, 13 Apr 2026 19:14:44 -0400 Subject: [PATCH] feat: add panel detection with multi-tier fallback system MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implement intelligent panel detection for manga/comics using a three-tier fallback system that automatically selects the best detection method: - Tier 1: OpenCV edge detection (fast, accurate for clear panel borders) - Tier 2: COCO-SSD ML detection (handles irregular layouts) - Tier 3: Grid-based detection (lightweight, always works) The system automatically falls back through tiers if higher tiers fail or if CSP blocks 'unsafe-eval' required by ML libraries. Changes: - panel-detection/detector.js: Modified to use dynamic script loading * Calls loadMLLibraries() on first use for lazy loading * Checks if ML libraries loaded successfully before using them * Falls back to grid detection if CSP blocks eval or libraries fail * Uses globalThis.cv/tf/cocoSsd for UMD/global library access - panel-detection/load-scripts.js: Created dynamic script loader * Dynamically injects