Open source CapCut alternative.
TypeScript
Tune vision detection: 1568px input and iou 0.7
David Le884116410e7b
diff --git a/apps/Donkey/Sources/Donkey/LocalUIElementDetection/DebugUIInspectionCoordinator.swift b/apps/Donkey/Sources/Donkey/LocalUIElementDetection/DebugUIInspectionCoordinator.swiftindex 7cfa9c33..193257a0 100644--- a/apps/Donkey/Sources/Donkey/LocalUIElementDetection/DebugUIInspectionCoordinator.swift+++ b/apps/Donkey/Sources/Donkey/LocalUIElementDetection/DebugUIInspectionCoordinator.swift@@ -1437,7 +1437,15 @@ final class DebugUIInspectionCoordinator {private static func compressedRemoteAIImage(from screenshot: CapturedWindowScreenshot) -> CompressedScreenshot {- ScreenshotCompression.compressedForModel(screenshot)+ // OmniParser's OCR runs on the uploaded pixels, so the default 896px / q0.48+ // (tuned for hosted LLM vision) blurs dense UI — e.g. file-list rows fuse into+ // one box. 1568px @ q0.8 separates them while staying a small payload (~hundreds+ // of KB, not MB); coordinates still map back through the returned pixelSize.+ ScreenshotCompression.compressedForModel(+ screenshot,+ maxPixelDimension: 1568,+ jpegQuality: 0.8+ )}}diff --git a/site/src/lib/inference/vision/parse.ts b/site/src/lib/inference/vision/parse.tsindex db2f7d01..fbb591e6 100644--- a/site/src/lib/inference/vision/parse.ts+++ b/site/src/lib/inference/vision/parse.ts@@ -22,7 +22,9 @@ function requireEnv(name: string): string {}const defaultBoxThreshold = 0.05;-const defaultIouThreshold = 0.1;+// 0.7 keeps adjacent/dense boxes (e.g. file-list rows) distinct; a low value+// over-merges neighbors. Matches the worker default in vision/handler.py.+const defaultIouThreshold = 0.7;const defaultImgsz = 640;// Raw worker output. bbox is [x1, y1, x2, y2] in ratio space (0-1).diff --git a/vision/handler.py b/vision/handler.pyindex 2420a6f2..17559c5b 100644--- a/vision/handler.py+++ b/vision/handler.py@@ -44,7 +44,7 @@ caption_model_processor = get_caption_model_processor()-def parse_image(image, box_threshold=0.05, iou_threshold=0.1, imgsz=640):+def parse_image(image, box_threshold=0.05, iou_threshold=0.7, imgsz=640):box_overlay_ratio = image.size[0] / 3200draw_bbox_config = {"text_scale": 0.8 * box_overlay_ratio,@@ -93,7 +93,9 @@ def handler(event):inp = event["input"]image_b64 = inp["image"]box_threshold = inp.get("box_threshold", 0.05)- iou_threshold = inp.get("iou_threshold", 0.1)+ # 0.7 keeps densely-packed, adjacent boxes (e.g. file-list rows) distinct;+ # a low value over-merges neighbors via NMS. See OmniParser remove_overlap_new.+ iou_threshold = inp.get("iou_threshold", 0.7)imgsz = inp.get("imgsz", 640)image_bytes = base64.b64decode(image_b64)