@@ -58,6 +58,8 @@ def main():
5858 parser .add_argument ("--height" , type = int , default = 480 )
5959 parser .add_argument ("--confidence" , type = float , default = 0.3 , help = "Minimum confidence threshold" )
6060 parser .add_argument ("--model" , type = str , default = "yolov8n.pt" , help = "YOLO model to use" )
61+ parser .add_argument ("--iou" , type = float , default = 0.5 , help = "IoU threshold for NMS (lower = fewer overlapping boxes)" )
62+ parser .add_argument ("--max-det" , type = int , default = 1 , help = "Maximum detections per frame" )
6163 args = parser .parse_args ()
6264
6365 if not YOLO_AVAILABLE or not CV2_AVAILABLE :
@@ -85,7 +87,7 @@ def main():
8587 return 1
8688
8789 # Run detection
88- results = model (frame , conf = args .confidence , verbose = False )
90+ results = model (frame , conf = args .confidence , iou = args . iou , max_det = args . max_det , verbose = False )
8991
9092 # Process results
9193 detections = []
@@ -146,7 +148,7 @@ def main():
146148
147149 # Run YOLO detection
148150 start_time = time .time ()
149- results = model (frame , conf = args .confidence , verbose = False )
151+ results = model (frame , conf = args .confidence , iou = args . iou , max_det = args . max_det , verbose = False )
150152 inference_time = time .time () - start_time
151153
152154 # Process and draw results
@@ -200,7 +202,7 @@ def main():
200202
201203 # Run YOLO
202204 start_time = time .time ()
203- results = model (frame , conf = args .confidence , verbose = False )
205+ results = model (frame , conf = args .confidence , iou = args . iou , max_det = args . max_det , verbose = False )
204206 inference_time = time .time () - start_time
205207 fps = 1.0 / inference_time if inference_time > 0 else 0
206208 fps_list .append (fps )
0 commit comments