feat: scale_penalty - score riflette dimensione oltre a forma
Shape matching e invariante scala per design: 3 ruote dentate di dim diverse avevano tutte score 1.00 confondendo l operatore. Parametro scale_penalty [0..1]: score_final = score * max(0, 1 - penalty * |scale - 1|) UI dropdown 'Peso dimensione nel score' con preset 0 / 0.3 / 0.5 / 0.8. Test rings con penalty 0.5: 1.00 -> 1.00, 0.95 -> 0.97, 0.80 -> 0.90. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -264,6 +264,7 @@ class SimpleMatchParams(BaseModel):
|
||||
scala: str = "fissa" # chiave SCALE_PRESETS
|
||||
precisione: str = "normale" # chiave PRECISION_ANGLE_STEP
|
||||
filtro_fp: str = "medio" # chiave FILTRO_FP_MAP
|
||||
penalita_scala: float = 0.0 # 0 = score shape invariante, >0 = penalizza scala != 1
|
||||
min_score: float = 0.65
|
||||
max_matches: int = 25
|
||||
|
||||
@@ -316,6 +317,7 @@ def _simple_to_technical(
|
||||
"max_matches": p.max_matches,
|
||||
"nms_radius": 0,
|
||||
"verify_threshold": FILTRO_FP_MAP.get(p.filtro_fp, 0.35),
|
||||
"scale_penalty": p.penalita_scala,
|
||||
}
|
||||
|
||||
|
||||
@@ -502,6 +504,7 @@ def match_simple(p: SimpleMatchParams):
|
||||
matches = m.find(
|
||||
scene, min_score=tech["min_score"], max_matches=tech["max_matches"],
|
||||
nms_radius=nms, verify_threshold=tech["verify_threshold"],
|
||||
scale_penalty=tech.get("scale_penalty", 0.0),
|
||||
)
|
||||
t_find = time.time() - t0
|
||||
|
||||
|
||||
@@ -48,6 +48,8 @@ function readUserParams() {
|
||||
scala: document.getElementById("p-scala").value,
|
||||
precisione: document.getElementById("p-precisione").value,
|
||||
filtro_fp: document.getElementById("p-filtro-fp").value,
|
||||
penalita_scala: parseFloat(
|
||||
document.getElementById("p-penalita-scala").value),
|
||||
min_score: parseFloat(document.getElementById("p-min-score").value),
|
||||
max_matches: parseInt(document.getElementById("p-max-matches").value, 10),
|
||||
};
|
||||
|
||||
@@ -101,6 +101,18 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label>Peso dimensione nel score
|
||||
<span class="hint">(penalizza scala ≠ 1.0)</span>
|
||||
</label>
|
||||
<select id="p-penalita-scala">
|
||||
<option value="0" selected>Nessuno (score shape puro)</option>
|
||||
<option value="0.3">Leggero (−30% max)</option>
|
||||
<option value="0.5">Medio (−50% max)</option>
|
||||
<option value="0.8">Forte (−80% max)</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label>Score minimo <span id="v-score">0.65</span>
|
||||
<span class="hint">(più basso = più match anche incerti)</span>
|
||||
|
||||
Reference in New Issue
Block a user