Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 2024-03-24 - Ultralytics YOLO verbose Output Blocking
**Learning:** By default, Ultralytics YOLO models log output synchronously to stdout. When calling `predict()` frequently (e.g., in loops or when processing many pages/images), this synchronous I/O can become a significant performance bottleneck, blocking execution while writing to the console.
**Action:** Always pass `verbose=False` to `model.predict()` in production or high-throughput code unless debugging output is explicitly required.
2 changes: 2 additions & 0 deletions commonforms/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
]
Expand All @@ -135,6 +136,7 @@ def extract_widgets(
augment=True,
imgsz=image_size,
device=self.device,
verbose=False, # Optimization: prevent synchronous stdout blocking overhead
)

widgets = {}
Expand Down