diff --git a/config.env.example b/config.env.example index d5423b2..536c25d 100644 --- a/config.env.example +++ b/config.env.example @@ -39,6 +39,11 @@ SCORE_SIGMOID=false # --- Detection --- # Confidence threshold – detections below this are discarded before NMS CONF=0.3 +# NMS IoU threshold (0-1): boxes overlapping the top box by more than this are +# suppressed. RAISE it (e.g. 0.6-0.7) if two close/overlapping objects are being +# merged into one and their separate boxes get suppressed. Lower = more aggressive +# merging. Default 0.45. +NMS_IOU=0.45 # --- ByteTrack tracking --- # Detections with score >= this get priority matching in the first association stage diff --git a/counter_live_rknn.py b/counter_live_rknn.py index 4847a97..7c4d9dd 100644 --- a/counter_live_rknn.py +++ b/counter_live_rknn.py @@ -39,6 +39,7 @@ LINE_Y2_FRAC = float(os.getenv("LINE_Y2_FRAC", "0.66")) IMGSZ = int(os.getenv("IMGSZ", "320")) HALF = os.getenv("HALF", "false").lower() == "true" CONF = float(os.getenv("CONF", "0.3")) +NMS_IOU = float(os.getenv("NMS_IOU", "0.45")) DEVICE = int(os.getenv("DEVICE", "0")) # RKNN NPU core mask @@ -1055,6 +1056,7 @@ def run(): core_mask=CORE_MASK, imgsz=IMGSZ, conf=CONF, + iou=NMS_IOU, num_classes=NUM_CLASSES, score_sigmoid=SCORE_SIGMOID, )