coolroman commited on
Commit
741233a
·
verified ·
1 Parent(s): 34af7df

v1.4: sparse3 no-hflip-tile lat-trimmed

Browse files
Files changed (1) hide show
  1. miner.py +23 -21
miner.py CHANGED
@@ -1,4 +1,4 @@
1
- """Plate-detection miner — v1.3 "sparse conditional tile-aug".
2
 
3
  Base weights: alfred8995/arabic002 (YOLO26s @ 1280, fp16, ~19 MB).
4
 
@@ -101,12 +101,13 @@ class Miner:
101
  self.sigma = 0.5
102
  self.max_det = 18
103
 
104
- # Conditional tile-pass
105
- self.sparse_threshold = 5 # fire tiles only if primary returns < this
106
  self.tile_conf = 0.40
107
  self.tile_overlap = 0.20
108
  self.novelty_iou = 0.10
109
  self.final_max_det = 22
 
110
 
111
  self.use_tta = True
112
 
@@ -314,24 +315,25 @@ class Miner:
314
  d[:, 3] += y1
315
  collected.append(d)
316
 
317
- # hflip tile pass
318
- flipped = cv2.flip(image, 1)
319
- for x1, y1, x2, y2 in tiles:
320
- fx1 = ow - x2
321
- fx2 = ow - x1
322
- if fx2 <= fx1:
323
- continue
324
- crop = flipped[y1:y2, fx1:fx2]
325
- if crop.size == 0:
326
- continue
327
- d = self._raw_dets(crop, self.tile_conf)
328
- if len(d):
329
- d_un = d.copy()
330
- d_un[:, 0] = (ow - (d[:, 2] + fx1))
331
- d_un[:, 2] = (ow - (d[:, 0] + fx1))
332
- d_un[:, 1] = d[:, 1] + y1
333
- d_un[:, 3] = d[:, 3] + y1
334
- collected.append(d_un)
 
335
 
336
  if not collected:
337
  return primary
 
1
+ """Plate-detection miner — v1.4 "sparse tile, no flip — lat-trimmed".
2
 
3
  Base weights: alfred8995/arabic002 (YOLO26s @ 1280, fp16, ~19 MB).
4
 
 
101
  self.sigma = 0.5
102
  self.max_det = 18
103
 
104
+ # Conditional tile-pass (trimmed for latency: no hflip, tighter sparse)
105
+ self.sparse_threshold = 3 # fire tiles only if primary returns < this
106
  self.tile_conf = 0.40
107
  self.tile_overlap = 0.20
108
  self.novelty_iou = 0.10
109
  self.final_max_det = 22
110
+ self.tile_use_hflip = False # skip hflip tile pass to save ~4 forwards
111
 
112
  self.use_tta = True
113
 
 
315
  d[:, 3] += y1
316
  collected.append(d)
317
 
318
+ # hflip tile pass (skipped when tile_use_hflip=False — saves 4 ONNX forwards)
319
+ if self.tile_use_hflip:
320
+ flipped = cv2.flip(image, 1)
321
+ for x1, y1, x2, y2 in tiles:
322
+ fx1 = ow - x2
323
+ fx2 = ow - x1
324
+ if fx2 <= fx1:
325
+ continue
326
+ crop = flipped[y1:y2, fx1:fx2]
327
+ if crop.size == 0:
328
+ continue
329
+ d = self._raw_dets(crop, self.tile_conf)
330
+ if len(d):
331
+ d_un = d.copy()
332
+ d_un[:, 0] = (ow - (d[:, 2] + fx1))
333
+ d_un[:, 2] = (ow - (d[:, 0] + fx1))
334
+ d_un[:, 1] = d[:, 1] + y1
335
+ d_un[:, 3] = d[:, 3] + y1
336
+ collected.append(d_un)
337
 
338
  if not collected:
339
  return primary