@@ -301,32 +301,34 @@ async def _run_detection_background(
301301 and detections .class_id is not None
302302 and detections .class_id .size > 0
303303 ):
304- img_height , img_width = image .shape [0 :2 ]
305- detected_objects = [
306- DetectedObject (
304+ img_height , img_width = image .shape [0 :2 ]
305+ detected_objects = [
306+ DetectedObject (
307307 label = self ._model .class_names [class_id ],
308308 x1 = x1 ,
309309 y1 = y1 ,
310310 x2 = x2 ,
311311 y2 = y2 ,
312- )
313- for class_id , (x1 , y1 , x2 , y2 ) in zip (
314- detections .class_id , detections .xyxy .astype (float )
315- )
316- ]
317- self .events .send (
318- DetectionCompletedEvent (
319- objects = detected_objects ,
320- raw_detections = detections ,
321- image_width = img_width ,
322- image_height = img_height ,
323- )
324- )
312+ )
313+ for class_id , (x1 , y1 , x2 , y2 ) in zip (
314+ detections .class_id , detections .xyxy .astype (float )
315+ )
316+ ]
317+ self .events .send (
318+ DetectionCompletedEvent (
319+ objects = detected_objects ,
320+ raw_detections = detections ,
321+ image_width = img_width ,
322+ image_height = img_height ,
323+ )
324+ )
325325 logger .debug (
326326 f"🔍 Detection complete: { len (detected_objects )} objects"
327327 )
328328 else :
329- logger .debug ("🔍 Detection complete but discarded (newer result exists)" )
329+ logger .debug (
330+ "🔍 Detection complete but discarded (newer result exists)"
331+ )
330332 except Exception as e :
331333 logger .warning (f"⚠️ Background detection failed: { e } " )
332334
0 commit comments