diff --git a/.jules/bolt.md b/.jules/bolt.md new file mode 100644 index 0000000..7bb4ef1 --- /dev/null +++ b/.jules/bolt.md @@ -0,0 +1,3 @@ +## 2024-05-18 - Ultralytics YOLO verbose synchronous I/O +**Learning:** Ultralytics YOLO models print detailed inference logs (timing, image size, detected objects) to stdout by default for every single prediction. Inside list comprehensions or inference loops, this synchronous stdout blocking creates noticeable overhead and slows down the loop unnecessarily. +**Action:** Always add `verbose=False` to `model.predict()` when calling YOLO models in loops or production environments where stdout logging is not needed to prevent I/O blocking overhead. diff --git a/commonforms/inference.py b/commonforms/inference.py index 527925f..1ae16bc 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, # Bolt: Prevent synchronous stdout I/O overhead ) for p in pages ] @@ -135,6 +136,7 @@ def extract_widgets( augment=True, imgsz=image_size, device=self.device, + verbose=False, # Bolt: Prevent synchronous stdout I/O overhead ) widgets = {}