From 5c726493fcf679f56c0fc8a211e74c51da62a5d9 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 11:35:06 +0000 Subject: [PATCH] perf: pass verbose=False to YOLO predictions to reduce stdout overhead Ultralytics YOLO models log predictions to stdout on every call by default. In a loop processing multiple pages, this synchronous logging blocks the main thread and introduces significant unnecessary performance overhead. This commit explicitly sets verbose=False for all model.predict() calls in inference.py. Co-authored-by: kingkillery <200727508+kingkillery@users.noreply.github.com> --- .jules/bolt.md | 3 +++ commonforms/inference.py | 2 ++ 2 files changed, 5 insertions(+) create mode 100644 .jules/bolt.md diff --git a/.jules/bolt.md b/.jules/bolt.md new file mode 100644 index 0000000..f686ed1 --- /dev/null +++ b/.jules/bolt.md @@ -0,0 +1,3 @@ +## 2026-04-18 - Ultralytics YOLO verbose Output Overhead +**Learning:** By default, Ultralytics YOLO models log predictions to stdout on every call. In a loop processing multiple pages, synchronous logging blocks the main thread, introducing significant unneeded performance overhead. +**Action:** Always pass `verbose=False` to `model.predict()` when running inference in loops or batch processes unless active debugging is needed. diff --git a/commonforms/inference.py b/commonforms/inference.py index 527925f..8d7b4ef 100644 --- a/commonforms/inference.py +++ b/commonforms/inference.py @@ -124,6 +124,7 @@ def extract_widgets( conf=confidence, augment=False, imgsz=ONNX_IMAGE_SIZE, + verbose=False, ) for p in pages ] @@ -135,6 +136,7 @@ def extract_widgets( augment=True, imgsz=image_size, device=self.device, + verbose=False, ) widgets = {}