Update script.py
Browse files
script.py
CHANGED
|
@@ -11,7 +11,7 @@ MODEL_WEIGHTS = "best.pt"
|
|
| 11 |
# ✅ 1. Sane Confidence:
|
| 12 |
# 0.20 was safe. We go slightly lower to 0.15 to improve Recall,
|
| 13 |
# relying on 'max_det' to fix the Precision.
|
| 14 |
-
CONF_THRESHOLD = 0.
|
| 15 |
|
| 16 |
def get_category_id(cls_id):
|
| 17 |
# IDs 0, 1, 2 are correct based on your experiments.
|
|
@@ -41,10 +41,10 @@ def run_inference(model, image_path, conf_threshold, save_path):
|
|
| 41 |
results = model.predict(
|
| 42 |
full_path,
|
| 43 |
conf=conf_threshold,
|
| 44 |
-
imgsz=1024, #
|
| 45 |
-
augment=False,
|
| 46 |
-
iou=0.
|
| 47 |
-
max_det=
|
| 48 |
verbose=False
|
| 49 |
)
|
| 50 |
|
|
|
|
| 11 |
# ✅ 1. Sane Confidence:
|
| 12 |
# 0.20 was safe. We go slightly lower to 0.15 to improve Recall,
|
| 13 |
# relying on 'max_det' to fix the Precision.
|
| 14 |
+
CONF_THRESHOLD = 0.05
|
| 15 |
|
| 16 |
def get_category_id(cls_id):
|
| 17 |
# IDs 0, 1, 2 are correct based on your experiments.
|
|
|
|
| 41 |
results = model.predict(
|
| 42 |
full_path,
|
| 43 |
conf=conf_threshold,
|
| 44 |
+
imgsz=1024, # Keep High Res
|
| 45 |
+
augment=False,
|
| 46 |
+
iou=0.60, # Slightly higher IoU to keep close instruments
|
| 47 |
+
max_det=5, # ⬅️ CRITICAL: Only allow top 5 instruments per image
|
| 48 |
verbose=False
|
| 49 |
)
|
| 50 |
|