From f7fbe7f7b72f1d21bcc11296eca47e27f5dbb3e0 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 21 Apr 2026 11:58:13 +0000 Subject: [PATCH] perf: disable YOLO stdout blocking Add `verbose=False` to `model.predict()` calls in `FFDNetDetector.extract_widgets` to prevent synchronous I/O blocking during loops. 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..2562a25 --- /dev/null +++ b/.jules/bolt.md @@ -0,0 +1,3 @@ +## 2024-05-18 - YOLO Stdout Blocking Overhead +**Learning:** Ultralytics YOLO models by default output synchronous progress logs to stdout during `.predict()`. This synchronous I/O blocking can significantly slow down prediction loops in production applications where the logs are not useful. +**Action:** Always pass `verbose=False` to `model.predict()` when using YOLO models in automated processing pipelines to avoid unnecessary I/O blocking. diff --git a/commonforms/inference.py b/commonforms/inference.py index 527925f..e6db10b 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, # Optimization: prevent synchronous stdout blocking overhead ) for p in pages ] @@ -135,6 +136,7 @@ def extract_widgets( augment=True, imgsz=image_size, device=self.device, + verbose=False, # Optimization: prevent synchronous stdout blocking overhead ) widgets = {}