Update miner.py
Browse files
miner.py
CHANGED
|
@@ -24,19 +24,7 @@ class TVFrameResult(BaseModel):
|
|
| 24 |
|
| 25 |
|
| 26 |
class Miner:
|
| 27 |
-
def __init__(self,
|
| 28 |
-
path_hf_repo: Path,
|
| 29 |
-
conf_thres: float = 0.21,
|
| 30 |
-
conf_high: float = 0.22,
|
| 31 |
-
iou_thres: float = 0.77,
|
| 32 |
-
tta_match_iou: float = 0.56,
|
| 33 |
-
max_det: int = 264,
|
| 34 |
-
min_box_area: int = 82,
|
| 35 |
-
min_w: int = 15,
|
| 36 |
-
min_h: int = 17,
|
| 37 |
-
max_aspect_ratio: float = 3.65,
|
| 38 |
-
max_box_area_ratio: float = 0.78,
|
| 39 |
-
) -> None:
|
| 40 |
model_path = path_hf_repo / "weights.onnx"
|
| 41 |
|
| 42 |
self.class_names = ['bus', 'car', 'truck', 'motorcycle']
|
|
@@ -90,26 +78,26 @@ class Miner:
|
|
| 90 |
|
| 91 |
# ---------- Scoring-oriented thresholds ----------
|
| 92 |
# Low threshold for candidate generation
|
| 93 |
-
self.conf_thres =
|
| 94 |
|
| 95 |
# High-confidence boxes can survive without TTA confirmation
|
| 96 |
-
self.conf_high =
|
| 97 |
|
| 98 |
# NMS threshold
|
| 99 |
-
self.iou_thres =
|
| 100 |
|
| 101 |
# TTA confirmation IoU
|
| 102 |
-
self.tta_match_iou =
|
| 103 |
|
| 104 |
-
self.max_det =
|
| 105 |
self.use_tta = True
|
| 106 |
|
| 107 |
# Box sanity filters
|
| 108 |
-
self.min_box_area =
|
| 109 |
-
self.min_w =
|
| 110 |
-
self.min_h =
|
| 111 |
-
self.max_aspect_ratio =
|
| 112 |
-
self.max_box_area_ratio =
|
| 113 |
|
| 114 |
print(f"✅ ONNX model loaded from: {model_path}")
|
| 115 |
print(f"✅ ONNX providers: {self.session.get_providers()}")
|
|
|
|
| 24 |
|
| 25 |
|
| 26 |
class Miner:
|
| 27 |
+
def __init__(self, path_hf_repo: Path) -> None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
model_path = path_hf_repo / "weights.onnx"
|
| 29 |
|
| 30 |
self.class_names = ['bus', 'car', 'truck', 'motorcycle']
|
|
|
|
| 78 |
|
| 79 |
# ---------- Scoring-oriented thresholds ----------
|
| 80 |
# Low threshold for candidate generation
|
| 81 |
+
self.conf_thres = 0.2124
|
| 82 |
|
| 83 |
# High-confidence boxes can survive without TTA confirmation
|
| 84 |
+
self.conf_high = 0.7225
|
| 85 |
|
| 86 |
# NMS threshold
|
| 87 |
+
self.iou_thres = 0.7704
|
| 88 |
|
| 89 |
# TTA confirmation IoU
|
| 90 |
+
self.tta_match_iou = 0.5609
|
| 91 |
|
| 92 |
+
self.max_det = 264
|
| 93 |
self.use_tta = True
|
| 94 |
|
| 95 |
# Box sanity filters
|
| 96 |
+
self.min_box_area = 82
|
| 97 |
+
self.min_w = 15
|
| 98 |
+
self.min_h = 17
|
| 99 |
+
self.max_aspect_ratio = 3.6571
|
| 100 |
+
self.max_box_area_ratio = 0.7807
|
| 101 |
|
| 102 |
print(f"✅ ONNX model loaded from: {model_path}")
|
| 103 |
print(f"✅ ONNX providers: {self.session.get_providers()}")
|