diff --git a/.jules/bolt.md b/.jules/bolt.md new file mode 100644 index 0000000..2c45357 --- /dev/null +++ b/.jules/bolt.md @@ -0,0 +1,3 @@ +## 2024-04-13 - Ultralytics YOLO Synchronous stdout Bottleneck +**Learning:** Ultralytics YOLO models by default print bounding box predictions and model details to stdout synchronously for every prediction call. Inside of loops or high-throughput batching, this blocks the main thread and introduces significant I/O latency, tanking performance. +**Action:** Always set `verbose=False` inside `.predict()` when using YOLO models in production or batch loops where logs are not explicitly needed. diff --git a/commonforms/inference.py b/commonforms/inference.py index 527925f..3f2a393 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 stdout blocking during loop ) for p in pages ] @@ -135,6 +136,7 @@ def extract_widgets( augment=True, imgsz=image_size, device=self.device, + verbose=False, # Optimization: prevent stdout blocking ) widgets = {}