SuperBitDev commited on
Commit
d8b8ba7
·
verified ·
1 Parent(s): b52fcb0

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. miner.py +9 -10
  2. weights.onnx +2 -2
miner.py CHANGED
@@ -37,7 +37,7 @@ class Miner:
37
  # balaclava=0, hoodie=1, glove=2, bat=3, spray paint=4, graffiti=5
38
  self.class_names = ['balaclava', 'hoodie', 'glove', 'bat', 'spray paint', 'graffiti']
39
  # ONNX class index order from training export (Ultralytics names 0..5 in dataset.yaml).
40
- model_class_order = ['balaclava', 'hoodie', 'glove', 'bat', 'spray paint', 'graffiti']
41
  self._train_cls_to_canonical = np.array(
42
  [self.class_names.index(n) for n in model_class_order],
43
  dtype=np.int32
@@ -94,19 +94,19 @@ class Miner:
94
  self.conf_thres = 0.25
95
 
96
  # Above this on orig view, accept directly. Below it, require TTA agreement.
97
- self.conf_high = 0.35
98
 
99
  # Standard NMS IoU; balaclavas / hoodies on the same person can
100
  # overlap heavily but they're different classes so the per-class
101
  # NMS handles that — 0.50 stays a safe default.
102
- self.iou_thres = 0.35
103
 
104
  # Balaclavas / hoodies barely shift between orig and h-flipped views,
105
  # but graffiti and bats can have asymmetric extents so a moderate
106
  # IoU gate keeps the consensus rule from getting too strict.
107
- self.tta_match_iou = 0.15
108
 
109
- self.max_det = 150
110
  self.use_tta = True
111
 
112
  # Box sanity filters tuned for crime:
@@ -116,11 +116,11 @@ class Miner:
116
  # graffiti can be very wide; allow up to 8.0
117
  # - a single graffiti tag can fill most of a wall, so allow up to
118
  # ~95% image-area for one box
119
- self.min_box_area = 10 * 10
120
- self.min_w = 6
121
- self.min_h = 6
122
  self.max_aspect_ratio = 8.0
123
- self.max_box_area_ratio = 0.95
124
 
125
  print(f"✅ ONNX model loaded from: {model_path}")
126
  print(f"✅ ONNX providers: {self.session.get_providers()}")
@@ -536,7 +536,6 @@ class Miner:
536
  - any box with conf >= conf_high
537
  - low/medium-conf boxes only if confirmed across TTA views
538
  Then run final hard NMS.
539
-
540
  All thresholds default to the instance attributes when not supplied,
541
  so the non-sweep path can call this without args. The sweep path
542
  passes explicit values to avoid mutating shared state across
 
37
  # balaclava=0, hoodie=1, glove=2, bat=3, spray paint=4, graffiti=5
38
  self.class_names = ['balaclava', 'hoodie', 'glove', 'bat', 'spray paint', 'graffiti']
39
  # ONNX class index order from training export (Ultralytics names 0..5 in dataset.yaml).
40
+ model_class_order = ['balaclava', 'bat', 'glove', 'graffiti', 'hoodie', 'spray paint']
41
  self._train_cls_to_canonical = np.array(
42
  [self.class_names.index(n) for n in model_class_order],
43
  dtype=np.int32
 
94
  self.conf_thres = 0.25
95
 
96
  # Above this on orig view, accept directly. Below it, require TTA agreement.
97
+ self.conf_high = 0.45
98
 
99
  # Standard NMS IoU; balaclavas / hoodies on the same person can
100
  # overlap heavily but they're different classes so the per-class
101
  # NMS handles that — 0.50 stays a safe default.
102
+ self.iou_thres = 0.5
103
 
104
  # Balaclavas / hoodies barely shift between orig and h-flipped views,
105
  # but graffiti and bats can have asymmetric extents so a moderate
106
  # IoU gate keeps the consensus rule from getting too strict.
107
+ self.tta_match_iou = 0.25
108
 
109
+ self.max_det = 50
110
  self.use_tta = True
111
 
112
  # Box sanity filters tuned for crime:
 
116
  # graffiti can be very wide; allow up to 8.0
117
  # - a single graffiti tag can fill most of a wall, so allow up to
118
  # ~95% image-area for one box
119
+ self.min_box_area = 64 * 64
120
+ self.min_w = 16
121
+ self.min_h = 16
122
  self.max_aspect_ratio = 8.0
123
+ self.max_box_area_ratio = 0.9
124
 
125
  print(f"✅ ONNX model loaded from: {model_path}")
126
  print(f"✅ ONNX providers: {self.session.get_providers()}")
 
536
  - any box with conf >= conf_high
537
  - low/medium-conf boxes only if confirmed across TTA views
538
  Then run final hard NMS.
 
539
  All thresholds default to the instance attributes when not supplied,
540
  so the non-sweep path can call this without args. The sweep path
541
  passes explicit values to avoid mutating shared state across
weights.onnx CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:97d6a4c1a6ec630ce8cf98d507b4838a3616592fa431e55533aaea19876c64b9
3
- size 19409709
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f672a170aa69723924770fbd6013c44ddc8139ef1d609c29a280a59aa7b57090
3
+ size 19409603