dev0524 commited on
Commit
9c25ca5
·
verified ·
1 Parent(s): 9d6491b

scorevision: push artifact

Browse files
Files changed (1) hide show
  1. miner.py +6 -1
miner.py CHANGED
@@ -24,6 +24,10 @@ from ultralytics import YOLO
24
  PERSON_CLS_ID = 0 # index into the element's objects list AND COCO's person id
25
  CONF_THRESHOLD = float(os.getenv("SV_CONF_THRESHOLD", "0.20"))
26
  IMG_SIZE = int(os.getenv("SV_IMG_SIZE", "416"))
 
 
 
 
27
 
28
 
29
  class BoundingBox(BaseModel):
@@ -64,7 +68,7 @@ class Miner:
64
  def __repr__(self) -> str:
65
  return (
66
  f"Person detector: {self.model_name} "
67
- f"(conf={CONF_THRESHOLD}, imgsz={IMG_SIZE})"
68
  )
69
 
70
  def predict_batch(
@@ -79,6 +83,7 @@ class Miner:
79
  batch_images,
80
  conf=CONF_THRESHOLD,
81
  imgsz=IMG_SIZE,
 
82
  classes=[PERSON_CLS_ID],
83
  device=os.getenv("SV_DEVICE", "cpu"),
84
  verbose=False,
 
24
  PERSON_CLS_ID = 0 # index into the element's objects list AND COCO's person id
25
  CONF_THRESHOLD = float(os.getenv("SV_CONF_THRESHOLD", "0.20"))
26
  IMG_SIZE = int(os.getenv("SV_IMG_SIZE", "416"))
27
+ # Fine-tuned weights produce more duplicate boxes on the same person at the
28
+ # ultralytics default (0.7); tightening NMS collapses most of them without
29
+ # losing genuinely separate closely-spaced people.
30
+ NMS_IOU = float(os.getenv("SV_NMS_IOU", "0.3"))
31
 
32
 
33
  class BoundingBox(BaseModel):
 
68
  def __repr__(self) -> str:
69
  return (
70
  f"Person detector: {self.model_name} "
71
+ f"(conf={CONF_THRESHOLD}, imgsz={IMG_SIZE}, iou={NMS_IOU})"
72
  )
73
 
74
  def predict_batch(
 
83
  batch_images,
84
  conf=CONF_THRESHOLD,
85
  imgsz=IMG_SIZE,
86
+ iou=NMS_IOU,
87
  classes=[PERSON_CLS_ID],
88
  device=os.getenv("SV_DEVICE", "cpu"),
89
  verbose=False,